|
actually it is third party dll . they send me the sample application
that use run time loading of .dll i.e. using getprocaddress ()etc.
that is very hard I donot want to use this. thats why I am asking for
import libary .
Trioum
|
|
|
|
|
Ask the third party instead. It will save everybody involved a lot of pain.
Steve
|
|
|
|
|
It's not really that hard loading a dll at run time.
Just make sure your function-pointers are correct, and since they provided a sample application you can basically copy-paste the loading of the dll and functions you require. This will save you headaches if they ever send an improved dll, you will not need to rebuild your own application then.
Regards,
Davy
|
|
|
|
|
There is a wnd with a list ctrl.
And I create a thread (referenced by h ) to fill the list ctrl.
And I wrote this:
CMyWnd::OnDestroy()
{
CWnd::OnDestroy();
WaitForSingleObject(h,INFINITE);
}
I think CListCtrl uses its owner message loop to do InsertItem , so there should be no problem to block the main wnd's msg loop. Why does it block here?
modified on Wednesday, April 16, 2008 1:56 AM
|
|
|
|
|
Short answer: Because h never becomes signaled.
Longer anwser: You haven't mentioned what h is! Give us a chance!
Steve
|
|
|
|
|
followait wrote: WaitForSingleObject(h,INFINITE);
Assuming h is the handle to the thread that is filling the List items.
followait wrote: I think CListCtrl uses its owner message loop to do InsertItem
The message loop is in the same thread where the OnDestroy Message is queue as the list control is created in that thread.
followait wrote: Why does it block here?
It is actually a deadlock as InsertItem sends the message to the List View control and waiting for the message to be processed while the message loop which processes the WM_DESTROY message from the same message queue waiting for the thread that send the message.
|
|
|
|
|
Thanks, it's helpful.
Could you tell me how to solve the problem?
|
|
|
|
|
I used the code below instead of WaitForSingleObject , but block when calling WaitForSingleObject
while(TRUE) {
DWORD result;
MSG msg;
result = MsgWaitForMultipleObjects(cnt,h,
TRUE,INFINITE,QS_ALLINPUT);
if (result==(WAIT_OBJECT_0)) {
break;
} else if (result=WAIT_OBJECT_0+cnt) {
PeekMessage(&msg, NULL,0,0,PM_REMOVE);
DispatchMessage(&msg);
}
}
How to sovle it?
|
|
|
|
|
followait wrote: result = MsgWaitForMultipleObjects(cnt,h, TRUE,INFINITE,QS_ALLINPUT); if (result==(WAIT_OBJECT_0)) { //never get here
try FALSE in the third parameter, bWaitAll
|
|
|
|
|
It's ok.
But I have several threads to be waited, how to do?
Thanks.
|
|
|
|
|
MsgWaitForMultipleObjects takes array of handles
|
|
|
|
|
But when fWaitAll is FALSE , how to ensure all the threads complete?
manually?
|
|
|
|
|
May be by adjusting the array and count of thread handles when a thread is signalled.
|
|
|
|
|
Have it done, thanks very much.
|
|
|
|
|
how to find out admin privelege using CheckTokenMembership
|
|
|
|
|
if you had read the documentation for CheckTokenMembership Function[^] you should have noticed the following
Example Code
The following example shows checking a token for membership in the Administrators local group.
BOOL IsUserAdmin(VOID)
.
.
.
|
|
|
|
|
|
HI!
Is there anyway a client can detect the server ip address in socket programming instead of hardcoding the ip address like i do e.g. Cservice.sin_addr.s_addr = inet_addr("131.181.98.71");
cheers
|
|
|
|
|
ADTC# wrote: Is there anyway a client can detect the server ip address
No, not if the server is on another host. If it is on the same host you can use the loopback adress 127.0.0.1 , in any other case you need to tell the socket where to connect to. It's probably best to make this configurable in your application.
/M
|
|
|
|
|
If you know the machine name, you can use something like getaddrinfo to translate from a name to an IP.
Judy
|
|
|
|
|
hi back again!
#include<winsock2.h><br />
#include <stdio.h><br />
int main(int argc, char *argv[])<br />
{<br />
HOSTENT *h;<br />
char *serverip;<br />
if (argc != 2) {
fprintf(stderr,"usage: getip address\n");<br />
exit(1);<br />
}<br />
printf("argv[0]:%s\n",argv[0]);<br />
printf("argv[1]:%s", argv[1]);<br />
h = gethostbyname(argv[1]);<br />
serverip = inet_ntoa(*((struct in_addr *)h->h_addr));<br />
printf("Host name : %s\n", h->h_name);<br />
printf("IP Address : %s\n",serverip);<br />
return 0;<br />
}</stdio.h></winsock2.h>
i was trying to run this code from Beej's web site and its command line so when i input ip address somehow the the hostname and ip address are not displayed on the output screen so i think that the ip address was not stored in the structure HOSTENT. can anyone execute this code and see whats wrong with this.
cheers
|
|
|
|
|
You shouldn't use the returned pointer from gethostbyname() without checking it, it can be NULL. Here is an example source code[^].
Hope it helps.
/M
|
|
|
|
|
How to include the resource file in Static lib?
How to invoke the dialog which is created in above static lib from Application(exe)?
Regards
Mallikarjun
|
|
|
|
|
hi
can u create ur own file extension in vc++ so when u double clicked ur application icon ,it opens in ur application .
thank u
any attachments would be helpful
thanks again
|
|
|
|
|
Assuming I understood your question correctly, yes.
Steve
|
|
|
|