|
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</
|
|
|
|
|
Verifier wrote:
strInsert += "strInsert += szName;
HUmm .. is that really what you wrote in your code ?
~RaGE();
|
|
|
|
|
nope. this is what i wrote:
strInsert = "<";
strInsert += szName;
strInsert += ">";
strInsert += strValue;
strInsert += "</";
strInsert += szName; //this line f***sup the whole string
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>yah</
And after it:
8Hsan>yah</
|
|
|
|
|
You could try
std::string strName(szName);
before your code snippet, and then only append strName.
But honestly, I have no idea what is happening to your string. You really should be able to use it this way.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Verifier wrote:
Can anyone tell me if the above commented line f***s up the string?
From what you displayed; yes it does.
Let me guess, you're using VC7 and got those results from watching the string in the debugger, not from really outputing it to the console (or something similar)?
Check the implementation of basic_string and you'll see what causes this (you might also want to search some MS NG's and see you're far from alone in having been bitten by this). An MS dude wrote some code (a debugger extension) to handle this. Should be available from the public.vc.lang NG archives.
|
|
|
|
|
Mike Nordell wrote:
Let me guess, you're using VC7 and got those results from watching the string in the debugger, not from really outputing it to the console (or something similar)?
yep. I printed out the text and it was correct.
thanks!
|
|
|
|