|
Thanks!
Appreciate your help,
ns
|
|
|
|
|
I was created Toolbar using CToolBarCtrl class.But I was unable change the state of the button?
How to change the state of the Button?
|
|
|
|
|
Use OnCommandUpdate message handler.
A. Riazi
|
|
|
|
|
I was created Toolbar using CToolBarCtrl class.But I was unable change the state of the button?
|
|
|
|
|
Hi,
I want to list all the application running in my machine currently. Is there any API which gives me that information. I used Process32First() and Process32Next() APIs to get the process list. Anything similar to this for the Application list?
Kindly help....
Vini
|
|
|
|
|
Are you speaking about the TaskManagers tab "Applications"? Then EnumWindows is possibly what you're looking for.
|
|
|
|
|
Mike Nordell wrote:
Are you speaking about the TaskManagers tab "Applications"? Then EnumWindows is possibly what you're looking for.
yes.. I want all the currently running application like in the taskmanager. Tnx for the help. I'll try this .
Vini
|
|
|
|
|
Look at he code provided in this article[^]. The functions FillList and ListWindows should help you retrieving the app names.
~RaGE();
|
|
|
|
|
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()
|
|
|
|