|
hi,
i'm trying to teach myself c++ (using mfc), i've just got a quick question. i'm not new to the vs enviorment, i've used it for c# programs.
i am running windows xp sp2 (home edition) with the newest version of the .net framework. i am using visual studio 2002.
when i place a 'rich edit 2.0 control' onto my form, the program won't run. when i remove the control, it runs.
when i run the program with a rich edit box, it looks like everything ran fine and i closed it, however i never even see the program's dialog. does anyone have suggestions to get this thing running?
this is what is in the output window:
'SomeProgram.exe': Loaded 'F:\Programming\SomeProgram\Release\SomeProgram.exe', Symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\comdlg32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\shell32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\winspool.drv', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\oleacc.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\msvcp60.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\Program Files\Google\Google Desktop Search\GoogleDesktopNetwork3.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\ws2_32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\ws2help.dll', No symbols loaded.
'SomeProgram.exe': Unloaded 'C:\Program Files\Google\Google Desktop Search\GoogleDesktopNetwork3.dll'
'SomeProgram.exe': Unloaded 'C:\WINDOWS\system32\ws2_32.dll'
'SomeProgram.exe': Unloaded 'C:\WINDOWS\system32\ws2help.dll'
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\MsgPlusLoader.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\PGPhk.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\Program Files\Xfire\xfire_toucan_17902.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\wsock32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\ws2_32.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\ws2help.dll', No symbols loaded.
'SomeProgram.exe': Loaded 'C:\WINDOWS\system32\msvcr71.dll', No symbols loaded.
The thread 'Win32 Thread' (0xb74) has exited with code 0 (0x0).
The program '[2808] SomeProgram.exe: Native' has exited with code 0 (0x0).
thanks in advance,
sam kline
-- modified at 19:13 Saturday 18th February, 2006
|
|
|
|
|
As with all common controls, you have to call the right init function to get them loaded and their window classes registered.
MFC has AfxInitRichEdit() which is the function to call in your situation.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
ok, but where do i put that?
thanks, sam kline
|
|
|
|
|
oh, found it.
AfxInitRichEdit2();
thanks!
|
|
|
|
|
Hi,
Let me explain using a very simple example: finding all combinations of 2
from a set of 6 letters {A, B, C, D, E, F}. The first combination is AB and the
last is EF
The total number of possible combinations is: n!/(r!(n-r)!)=6!/(2!(6-2)!)=15
combinations
Let me show you all the combinations first:
AB
AC
AD
AE
AF
BC
BD
BE
BF
CD
CE
CF
DE
DF
EF
I want to print all the comibinations..........
Regards
James
|
|
|
|
|
You know the algorithm because you just did it manually. Two nested loops, one going from A to E, the other going from one letter after the first loop's letter to F. In each iteration of the inner loop, print out the current letters for both loops.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
void PrintCombinations(char set[],int set_size)
{
for (int i = 0; i < (set_size - 1); i++) {
for (int j = (i + 1); j < set_size; j++) {
printf("%c%c\n",set[i],set[j]);
}
}
} Please note that I haven't actually tried this; I just coded it off the top of my head.
Software Zen: delete this;
|
|
|
|
|
Does anybody know how to copy files or create directory for a windows environment.
I only know how to use the create and copy methods in a .net framework.
Thanks
Kelvin Chikomo
|
|
|
|
|
|
Hi all. I´m trying to use the API method SetWindowTheme() to completly ride my application from XP theme. My application has custom caption bar and border, and it looks strange when the XP theme is set. But nothing happens when I call this method.
My code:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...
SetWindowTheme(this->m_hWnd, NULL, NULL );
return 0;
}
This should work? Please, anyone can help me?
|
|
|
|
|
From the docs:When pszSubAppName and pszSubIdList are NULL, the theme manager removes the previously applied associations. To prevent visual styles from being applied to a specified window, pass an empty string, (L""), which will not match any section entries.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Thanks very much.
|
|
|
|
|
I have class A:CWinApp then call many dialog.Domodal() without main windows.Because we not assign value for m_pMainWnd so that dialog is no longer modal dialog.
|
|
|
|
|
You can't have more than one modal dialog at a time; that's what it means for a dialog to be modal. It takes over the message loop for the application while it is displayed, and control doesn't return to the primary window until the modal dialog closes.
If you want to have multiple dialogs opened simultaneously by an application, you will need to make them modeless. Instead of calling DoModal() , call Create() and ShowWindow() .
Software Zen: delete this;
|
|
|
|
|
hi,
I have ,say N=4 and r=3, i want to display all combinations of Ncr.....
i.e
123
234
341
421...etc
There should not any repition like 123..321..231..etc..it should display only one .......
thanks before..
James
-- modified at 13:48 Saturday 18th February, 2006
|
|
|
|
|
|
To print All the combinations of N elements with r combinations.......
-- modified at 14:24 Saturday 18th February, 2006
|
|
|
|
|
http://www.codeproject.com/cpp/CombC.asp[^]
First google, then "codeproject" then ask in a forum. My google search string was "C++ choose r from n combination algorithm" - and the 1st hit was the above link. Searching on google is an art - and forums are there when that art fails (which it does sometimes).
Koushik Biswas
|
|
|
|
|
hi
I need to write a program in VC++ using MFC sockets(CAsyncSocket) which give a list of all the nodes on LAN. I am able to get IP Addresses of all the connected nodes. but how to get the node names, for e.g. node19. Is it related to DHCP somehow. I don't know anything about DHCP right now.
Its really urgent.
please reply soon.
|
|
|
|
|
If you have the IP addresses, then you should be able to use getnameinfo().
Description on MSDN website: the getnameinfo function provides name resolution from an address to the host name.
You can take this link[^] to the documentation.
Hope this helps,
Dan
Remember kids, we're trained professionals. Don't try this at home!
|
|
|
|
|
Thanx Dan,
I have tried it but it gives the following error:
error C2065: 'getnameinfo' : undeclared identifier
Complete code of the .cpp file is :
<br />
<br />
#include "stdafx.h"<br />
#include "th1.h"<br />
#include "SockOLN.h"<br />
#include "OnLineNodes.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
<br />
CSockOLN::CSockOLN()<br />
{<br />
}<br />
<br />
CSockOLN::~CSockOLN()<br />
{<br />
}<br />
<br />
#if 0<br />
BEGIN_MESSAGE_MAP(CSockOLN, CAsyncSocket)<br />
END_MESSAGE_MAP()<br />
#endif // 0<br />
<br />
void CSockOLN::OnConnect(int nErrorCode) <br />
{<br />
AfxMessageBox("Connected");<br />
int i,pos1,pos2;<br />
BYTE a1,a2,a3,a4;<br />
struct sockaddr_in s;<br />
struct in_addr ad;<br />
char* hostn,*sern;<br />
CString st;<br />
UINT po;<br />
GetPeerName(st,po);<br />
s.sin_family = AF_INET;<br />
pos1=st.Find('.',0); <br />
a1=atoi((LPCTSTR)st.Left(pos1));<br />
pos2=st.Find('.',pos1+1); <br />
a2=atoi((LPCTSTR)st.Mid(pos1+1,pos2));<br />
pos1=st.Find('.',pos2+1); <br />
a3=atoi((LPCTSTR)st.Mid(pos2+1,pos1));<br />
pos2=st.Find('.',pos1+1); <br />
a4=atoi((LPCTSTR)st.Mid(pos1+1,pos2));<br />
ad.S_un.S_un_b.s_b1 =a1;<br />
ad.S_un.S_un_b.s_b2 =a2;<br />
ad.S_un.S_un_b.s_b3 =a3;<br />
ad.S_un.S_un_b.s_b4 =a4;<br />
s.sin_addr = ad;<br />
s.sin_port = po;<br />
hostn=new char[20];<br />
sern=new char[20];<br />
getnameinfo(&s,sizeof(s),hostn,20,sern,20,NI_NAMEREQD);<br />
((COnLineNodes*)DialPar)->m_List.AddString(st);<br />
((COnLineNodes*)DialPar)->m_List.AddString(hostn);<br />
Close();<br />
CAsyncSocket::OnConnect(nErrorCode);<br />
}<br />
<br />
void CSockOLN::listen()<br />
{<br />
Create(3000);<br />
Listen();<br />
}<br />
<br />
void CSockOLN::OnAccept(int nErrorCode) <br />
{<br />
AfxMessageBox("Connection Accepted");<br />
CAsyncSocket::OnAccept(nErrorCode);<br />
}<br />
<br />
void CSockOLN::SetSockPar(CDialog *d)<br />
{<br />
DialPar=d;<br />
}<br />
<br />
kindly reply soon.
|
|
|
|
|
rohini sharma wrote: error C2065: 'getnameinfo' : undeclared identifier
That suggests that you failed to include the needed header files. The documentation says:
Requirements
Client
Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95.
Server
Requires Windows Server "Longhorn", Windows Server 2003, Windows 2000 Server, or Windows NT Server.
Header
Declared in Ws2tcpip.h.
Declared in Wspiapi.h on Windows 2000, Windows NT, and Windows Me/98/95.
DLL
Requires Ws2_32.dll.
Unicode
Implemented as GetNameInfoW (Unicode) and GetNameInfoA (ANSI).
Are you sure you've included the proper headers for this function? If you include the headers and the compiler still complains about an 'undeclared identifier', then you could be working with an older version of the SDK that simply didn't include this definition.
Regards,
Dan
Remember kids, we're trained professionals. Don't try this at home!
|
|
|
|
|
If i include "Wspiapi.h" it gives error on that line Ünable to open file Wspiapi.h
This project is same for client as well as server. I am working on Windows 2000 professional as well as WinXP Professional.
|
|
|
|
|
Search your development machine for those two header files (wspiapi.h and ws2tcpip.h). On my system they reside in C:\PROGRAM FILES\MICROSOFT SDK\INCLUDE.
If they don't exist at all on your machine, then it's little wonder that the compiler can't find them. You will need to upgrade your development environment.
If they do exist, then you probably have an issue with the list of directories the compiler is searching to find them. For VC++ 6 I can get to that information by clicking [Tools] -> [Options] -> [Directories].
Regards,
Dan
Remember kids, we're trained professionals. Don't try this at home!
|
|
|
|
|
My project needs to recognize two different file types(different extention name).How to set file filter to make file dialog showing two file type with that kind of extention name? My IDE is Visual C++ 6.0 with SP6.
Thanks in advance.
Best,
xyhan
|
|
|
|
|