|
well I guess Get/Set are member func if not I wonder how Get will return mstr??. If they are member funcs then back to square one!!! I did not know that I could access member funcs in global static function(CompareModes) then I would not have faced any problem
|
|
|
|
|
Actually, what is your compare function comparing ? if you passed the dialogs as arguments, (I means arg1 and arg2 are dialogs), then your pointer cast should do :
CDialogA *pDlgA = (CDialog A*) arg1; // I'm not sure if i'm not missing a * here ...
and you should be able to access your data with p1->GetBlaBlaBla();
~RaGE();
|
|
|
|
|
the socket has been bind but my server is still not listning to my port, it just gives a INVALID_SOCKET.
<small>UINT ServerThread(LPVOID Param)<br />
{<br />
SOCKET server;<br />
WSADATA wsaData;<br />
sockaddr_in local;<br />
ServerStart = TRUE;<br />
<br />
int wsaret = WSAStartup(0x101, &wsaData);<br />
<br />
if (wsaret != 0)<br />
{<br />
return 0;<br />
}<br />
<br />
local.sin_family = AF_INET;<br />
local.sin_addr.s_addr = INADDR_ANY;<br />
local.sin_port = htons((u_short)20248);<br />
server=socket(AF_INET,SOCK_STREAM,0);<br />
<br />
if(server==INVALID_SOCKET)<br />
{<br />
AfxMessageBox("server invalid socket");<br />
return 0;<br />
}<br />
<br />
if (bind(server, (sockaddr*)&local, sizeof(local)) == SOCKET_ERROR)<br />
{<br />
AfxMessageBox("Binden van socket mislukt"); <br />
return 0;<br />
}<br />
<br />
SOCKET client;<br />
sockaddr_in from;<br />
int fromlen = sizeof(from);<br />
<br />
AfxMessageBox("Server gestart");<br />
<br />
char temp[512];<br />
<br />
while(ServerStart == TRUE)<br />
{<br />
client = accept(server, (struct sockaddr*)&from, &fromlen);<br />
if (client != INVALID_SOCKET)<br />
{<br />
AfxMessageBox("accept");<br />
sprintf(temp, "Your IP is %s\r\n", inet_ntoa(from.sin_addr));<br />
<br />
send(client, temp, strlen(temp), 0);<br />
closesocket(client);<br />
}<br />
else<br />
{<br />
AfxMessageBox("invalid socket");<br />
}<br />
}<br />
<br />
AfxMessageBox("Server Afgesloten");<br />
<br />
closesocket(server);<br />
<br />
WSACleanup();<br />
<br />
return 0;<br />
}</small>
what am i doing wrong? the programm keep giving the message: " invalid socket "
|
|
|
|
|
solution: changed the opening of de server connection, it works now...
|
|
|
|
|
Hi,
Use WSAGetLastError(), instead of printing some message. From the error index it's easy to find out what went wrong.
Satya
|
|
|
|
|
I have a class A{ public :CString m_str;}
static int func()not in the class. How can I acess m_str in this function func()
|
|
|
|
|
make an object of this class like A b;
and use it like b.m_str; or make get set functions in class..and then use those functions..but first include this file into the file where your function is..i hope this works..
cheers
Himanshu
|
|
|
|
|
Declare a static varible:
static A b;
then,
void func()
{
b.m_Str="something";
}
A. Riazi
|
|
|
|
|
Hi,
I'm creating a program with MFC 6 that needs to do this:
- identify the default gateway of the machine where it is run
- ping that IP and detect wheter it answers or not
Actually, I've done both already. For the first I use iphlpapi, and for the second I use CPing.
Now, the problem is that this program needs to run in any Windows version, and my exe only runs in Windows 2000/XP. It doesn't run in 95/98, and it NEEDS to.
How can I do a program that does this for any Windows version?
I'd appreciate any help.
Thanks a lot.
-- narada
|
|
|
|
|
Install winsock.dll version 2 on win95!
A. Riazi
|
|
|
|
|
Well, the Windows 95 in which I'm testing does have winsock.dll (version n. 3.10). The first error it gave me was that it didn't find iphlpapi.dll. I installed this dll and the error message now is: "The file iphlpapi.dll is expecting a more recent Windows version". But I need it to work on Windows 95, so upgrading the Os is not a solution!
In WIndows 98 my error is: "The SAMLIB.DLL file is linked to missing export NTDLL.DLL:RtlUpcasedUnicodeStringToOemString".
In Windows 2000 it works perfectly.
In WIndows Nt the error is: "The entrance point to the procedure RtlDtringFromGUID couldn't be found in the dynamic link library NTDLL.DLL"
Any ideas?
Thanks so much.
-- narada
|
|
|
|
|
I think this problem is taken from diference of NT and 98 to hande strings. Windows 95/98 do not support unicode. RtlUpcasedUnicodeStringToOemString function use unicode strings that Win9X does not support it. For adding unicode capability to Win9X, refer to this page[^].
A. Riazi
|
|
|
|
|
I tried copying the unicows.dll in the system folder of the win9x machines, but it still doesn't work. Actually, the error is the same.
Any ideas?
n
|
|
|
|
|
|
What I download through your link is a file called:
unicows.exe
When I double click on it, it asks me 'please select the location where you want to place the extracted files'. And then it places there the files:
License.Txt
redist.txt
unicows.pdb
unicows.sym
unicows.dll
There's no proper installation done. So I guess I have to copy these in the Windows\System folder of the Win9x machine, right?
I did this and there's no change in the behavior whatsoever.
Any ideas?
n
|
|
|
|
|
I need to ask for confirmation when finishing an app, how can I process the messages sent by any way of closing an application? ("Exit" in File Menu, the cross at top-right in the window, or even using task manager)
Thank you.
|
|
|
|
|
Override ( from memory ) OnClose and only call the base method if your confirmation dialog returns in the affirmative.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
It'd probably be fairly easy to make a bot that'd post random stupid VB questions, and nobody would probably ever notice - benjymous - 21-Jan-2003
|
|
|
|
|
Hm. one question: how do you handle if application shuts down (user action) -or- windows shuts down? I mean, it isn't comfortable to show a dialog when system restarts.
|
|
|
|
|
Well, in that case, what *can* you do ? If your app needs to confirm shutdown, it should do so always.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
It'd probably be fairly easy to make a bot that'd post random stupid VB questions, and nobody would probably ever notice - benjymous - 21-Jan-2003
|
|
|
|
|
Ok, that works, I've override onclose, and it's ok. And what about killing the process from task manager, is it possible to do the same?
Thanks a lot.
|
|
|
|
|
If a process is killed, you get no say in what happens at all, it is simply stopped.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
It'd probably be fairly easy to make a bot that'd post random stupid VB questions, and nobody would probably ever notice - benjymous - 21-Jan-2003
|
|
|
|
|
<br />
<small>SOCKET server;<br />
WSADATA wsaData;<br />
sockaddr_in local;<br />
ServerStart = TRUE;<br />
int wsaret = WSAStartup(0x101, &wsaData);<br />
if (wsaret != 0)<br />
{<br />
return 0;<br />
}<br />
local.sin_family = AF_INET;<br />
local.sin_addr.s_addr = INADDR_ANY;<br />
local.sin_port = htons((u_short)20248);<br />
if (bind(server, (sockaddr*)&local, sizeof(local)) == SOCKET_ERROR)<br />
{<br />
return 0;<br />
}</small><br />
What am i doing wrong?
|
|
|
|
|
willempipi wrote:
What am i doing wrong?
Perhaps you could try creating the socket before you try to bind it.
|
|
|
|
|
|
strInsert is a std::string, szName is const char* and strValue is a std::string.
strInsert = "<";
strInsert += szName;
strInsert += ">";
strInsert += strValue;
strInsert += "\r\n";
Can anyone tell me if the above commented line f***s up the string?
The string looks like this before the commented line:
<hejsan>yahyah</
|
|
|
|