|
Rage wrote:
Look at he code provided in this article[^]. The functions FillList and ListWindows should help you retrieving the app names.
Got it!!! Thank you very much..
Vini
|
|
|
|
|
Use EnumProcess!
There are some articles on CP.
A. Riazi
|
|
|
|
|
Hi,
I'm macking a Container application that hosts Activex Controls. I'm trying to provide scripting facility to my application using IActiveScriptSite. How do i expose the interfaces of the ActivexControl (i.e properties and methods) to the Scripting engine. any help would be highly appreciated.
|
|
|
|
|
IActiveScript::AddTypeLib
|
|
|
|
|
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 if they are in separate files ..i hope this works..
cheers
Himanshu
|
|
|
|
|
The case is as below
class A {public cstring mstr;
func();}
static int CompareModes(const void *arg1, const void *arg2 );
A::func()
{
....
qsort ((void *)lpModes, (size_t)cModes, sizeof(LPDDModeInfo), CompareModes);
}
int CompareModes(const void *arg1, const void *arg2)
{
CB *p1, *p2;
p1 = *(CB**)arg1;
p2 = *(CB**)arg2;
CString str1, str2;
str1 = p1->GetValue(mstr);
str2 = p2->GetValue(mstr);
return str1.CompareNoCase(str2);
}
here I need to access mstr in the static func CompareModes
|
|
|
|
|
hi,
thats what i was telling you..but i guess you didn't understood..anyway..inside your function like this
int CompareModes(const void *arg1, const void *arg2)
{
[red]
a b;
CB *p1, *p2;
p1 = *(CB**)arg1;
p2 = *(CB**)arg2;
CString str1, str2;
//in place of mstr use b.mstr and that will do..
str1 = p1->GetValue(mstr);
str2 = p2->GetValue(mstr);
return str1.CompareNoCase(str2);
}
i hope you r done this time..
cheers
Himanshu
|
|
|
|
|
I guess more info had to be given, A is a dlg class and I have a combo in it and onSelandOK I fill the mStr member. The on clicking another button I do some sorting and there in I need the mstr. So there is no point in creating a new obj in comparemodes. I need to access the member's value of the same obj that's calling func()
|
|
|
|
|
You should not retrieve the string value in CompareModes, but in your dialog. Extend your comparison function to pass the strings retrieved in parameter.
Crap, you cannot since CompareModes is a callback. Why is your pointer cast not working ? Does it compile ? If yes, do you have an error at runtime ?
~RaGE();
|
|
|
|
|
that's what was my secong idea..use get and set functions like..
void setmstr(cstring _mstr){mstr=_mstr;}
CString Getmstr(){ return mstr;}
so where you click to set mstr call setmstr() and it will store the value for you and where you need the value call getmstr() function which returns a CString..
so i guess that will do..
PS don't unfold the problem one by one..its gud to understand each and everything once..
Himanshu
|
|
|
|
|
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
|
|
|
|
|