|
|
I don't know chinese.Not able to read the web site content/
|
|
|
|
|
i have created a mfc code in windows vista. but i cant run it in debug mode. it shows
"The ordinal could not be losded in the dynamic link library MFC42D.DLL". but it is successfully running in release mode. what to do for this, pls help me
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
XP and Vista installations include the VS6 MFC release-mode Dlls, but not the debug-mode DLLs. You have to copy the MFC debug DLLs to the machine where you want to run. To find out which DLLs you will need, google for the dependency checker program Depends.exe.
|
|
|
|
|
Find out MFC42D.dll , and copy to system32 directory .
|
|
|
|
|
In my program I have used a lot of resouce. Such as: image(bmp, gif,...), config file(xml, txt, ini).There are more than 100 images and 10 config-files which is saved in a lot of folders. Now I don't want the user directly change or see these images and config files. Is there any way to package or make these resource unreadable.
Currently, my resources are all in the folder.I haven't compile them into my program.
I know vc6.0 can manage the resource. But it is still too weak for me. I want to manage my resource like a tree. Can add a directory or resource just as I want.
Maybe I will have to develop a resource manage tool.
|
|
|
|
|
I have created the appliaction for 2000/XP 32 bits. And i want to run my Application on Vista so what are the changes that i have to make my application Vista compitible.
Note :-I am using Visual srudio 2005
With Regards
RYK
|
|
|
|
|
VC_RYK wrote: what are the changes that i have to make
With luck, none at all. Most XP programs will work fine, although with some annoying UAC messages. You will have to try it and see.
|
|
|
|
|
what is the purpose of OnCtlColor
i have used one brush in onctlcolor and i am returning the handle of that brush.
cos of that GDI objects(can see in task manager) are going on increasing and memory usage is also increasing.
if i comment that brush everything is ok.. nothing is increasing. but in my application i must use that brush to draw the whole application.
can anyone give me solution to solve that problem
regards
sudhakar
|
|
|
|
|
make the brush a member of your Window class!
what is the purpose of OnCtlColor=> RTFM
Greetings from Germany
|
|
|
|
|
i need to change the color of the the entire dialog not only the controls on that dialog.
regards
sudhakar
|
|
|
|
|
The background can you paint in OnEraseBkgnd()
Greetings from Germany
|
|
|
|
|
I guess you are creating a new brush in every time in OnCtlColor function.
if yes a simple solution would be to
1>make the brush object as a memeber of a classs
2>create thebrush object only once say in the constructor.
3>return the same handle every time in the function.
4>delete the object in the destructor.
Thanks
Rizwan
|
|
|
|
|
Hi all,
Lets say one has created a thread using _beginthread() and now that thread is active and running. Now one wants to pass arguments to that thread function, but remember that the thread was already created. Now ... how can one (if it is possible) call that thread function, without calling _beginthread() again.
I.E
int callThreadFunc()
{
}
void myThread(void* a)
{
while (1)
{
Sleep(1000);
}
}
void main()
{
_beginthread(myThread, NULL, 0);
...
}
Many Thanks
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
with global variables, but you have the problem of syncronizing. If threads work together you need to syncronize them!!! Everything else is crap. For instance with WaitForMultipleEvent()
Greetings from Germany
|
|
|
|
|
|
You can't really pass arguments to your thread the way you describe. Instead, what you do, is pass a pointer to a certain object when you start your thread. Then, your thread can check this object to retrieve information (now, how it is done really depends on your app). Basically, it doesn't change anything to the fact that it is a separate thread. EXCEPT, that you need to secure the access to the variables using critical sections (for example), so that only one thread will access a variable at a time.
|
|
|
|
|
Thanks Cédric,
Cedric Moonen wrote: that you need to secure the access to the variables using critical sections (for example), so that only one thread will access a variable at a time.
If I understand you correctly ... would it be a good idea using global variables, but keeping it in sync ?
Many Thanks
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
There are two common ways:
- With a UI-thread you post a message with the information you want to pass to the thread
- With a worker thread (like your example) you have a place where the thread knows it can find information, such as a queue, a struct on the heap or class member variables. When the thread is supposed to get the new information you signal an event or semaphore that the thread is waiting on with
::WaitForMultipleObjects(...) .
Don't forget to synchronize the threads to avoid data corruption.
For more info on workerthreads, read this article[^].
For more info on semaphores and queues between workerthreads, read this article[^].
You will find a third alternative with I/O completion ports here[^]. The article also discuss when thread synchronization isn't needed, or could be avoided.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: When the thread is supposed to get the new information you signal an event or semaphore that the thread is waiting on
Never though of that, thank you very much Rodger
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
hi i am using the below code for dummy multithreading application.
first function listens request and the thread started with thread function
but some client start receving data but some one not get the single respomnse back . can any one help me what's gona wong with this code
thanks
///////the server function//////////////////
void thread::startserver()
{
DWORD dwStatus;
WSAEVENT handles[1];
struct sockaddr_in cli_addr;
int clilen = sizeof(cli_addr);
memset(&cli_addr,0,sizeof(struct sockaddr));
printf("***********server started****************\n");
while (TRUE)
{
handles[0] = WSACreateEvent();
WSAEventSelect(m_hSockethndl, handles[0], FD_ACCEPT);
dwStatus = WSAWaitForMultipleEvents(1, handles, TRUE, 50, FALSE);
if (dwStatus == WSA_WAIT_EVENT_0)
{
SOCKET cli_socket;
cli_socket=-1;
cli_socket = accept(m_hSockethndl, (struct sockaddr *) &cli_addr, &clilen);
// set linger option
LINGER linger;
linger.l_onoff = 1;
linger.l_linger = 0;
setsockopt(cli_socket, SOL_SOCKET, SO_LINGER, (char *)&linger, sizeof(LINGER));
//setsockopt(cli_socket, IPPROTO_TCP, TCP_NODELAY, NULL, 0);
int flag = 1;
int result = setsockopt(cli_socket, /* socket affected */
IPPROTO_TCP, /* set option at TCP level */
TCP_NODELAY, /* name of option */
(char *) &flag, /* the cast is historical cruft */
sizeof(int)); /* length of option value */
if (result < 0)
{
printf("Client Socket No Delay Option Failed");
}
//printf("Thread started with the server socket=%d and client port=%d and ip=%s\n",cli_socket,cli_addr.sin_port,inet_ntoa(cli_addr.s in_addr));
/*threadParmas thparam;
memset(&thparam,0,sizeof(threadParmas));
thparam.cli_addrth=cli_addr;
thparam.threadsocket=cli_socket;*/
//CreateThread(NULL, 0, StartThread, &thparam, 0, &dwThreadID);
CreateThread(NULL, 0, StartThread, &cli_socket, 0, &dwThreadID);
FD_SET(cli_socket, &set_sockets);
}
WSACloseEvent(handles[0]);
}
}
//////////////////the thread function////////////////////
DWORD WINAPI thread::StartThread (void * thparam)
{
/* struct threadParmas threadparam;
threadparam.threadsocket=((struct threadParmas *)thparam)->threadsocket;
threadparam.cli_addrth=((struct threadParmas *)thparam)->cli_addrth;*/
SOCKET socket_handle;
u_short Clientport;
//socket_handle=threadparam.threadsocket;
socket_handle=*(SOCKET *)thparam;
//Clientport=ntohs(threadparam.cli_addrth.sin_port);
char data[256];
char Resdata[512];
memset(data,0,256);
memset(Resdata,0,512);
int counter=1;
int bytes =1;
while(bytes)
{
WSAEVENT we = WSACreateEvent();
WSAEVENT handles[1];
handles[0] = we;
WSAEventSelect(socket_handle, we, FD_READ | FD_CLOSE);
//receiving data from client
for (int i = 0; i < WAIT_MULTIPLE; i++)
{
DWORD available = WSAWaitForMultipleEvents(1, handles, TRUE, WAIT_TIME, FALSE);
if (available == WSA_WAIT_EVENT_0)
{
if ((bytes = recv(socket_handle, data, 256, 0)) < 0)
{
int er = WSAGetLastError();
printf("Error=%d while receive data from socket %d\n",er,socket_handle);
bytes = 0;
break;
}
else
break;
}
}
WSACloseEvent(we);
strcpy_s(Resdata,512,"Response send Ack");
if(bytes)
{
//printf("socket %d Message %3d received client port=%d, ip=%s size=%d\n",socket_handle,counter,Clientport,inet_ntoa(thread param.cli_addrth.sin_addr),bytes);
//go to sleep for internal processing
//printf("socket %d Message %3d received size %d %s\n",socket_handle,counter,bytes,data);
Sleep(2000);
//sending the dummy response to the client
if (send(socket_handle, Resdata, strlen(Resdata), 0) != strlen(Resdata))
{
int er = WSAGetLastError();
printf("ERROR %d IN SENDING %d RESPONSE by socket =%d\n",er,counter,socket_handle);
return 0;
}
//printf("***Response %3d send by the server socket=%d, client port=%d, ip=%s\n",counter,socket_handle,Clientport,inet_ntoa(thread param.cli_addrth.sin_addr));
//printf("***Response %3d send by the server socket=%d\n",counter,socket_handle);
}
//keeping track how many packets this specific client sends
counter++;
}
return 1;
}
|
|
|
|
|
Hai All,
I'm working in VC++ 6.0.There I've created a dialog based appl in MFC.
1.I've created a CButton and placed a bitmap over it using LoadBitmap function,say,IDB_BITMAP1.
2.Now I need the button to be resized along with the Dailog.
3.I've written the code for the buttton resizing in OnSize ();
4.Now my trouble starts.I want to use the same already loaded bitmap (IDB_BITMAP1)to be resized according to the button size.But now onlt the button is resizing and not the bitmap.
So please tell me is there any way to resize(ie,streach or skew) the bitmap according to the content size.
Thanks in advance
|
|
|
|
|
You need a ownerdrawn Button. So look for samples here at CP or write a own one. Override OnPaint() with a StretchBlt
Greetings from Germany
|
|
|
|
|
Hello thanks for your kind reply,
Can you please explain to me in depth how to streach the Bitmap image.I've used the ownerdrawn button.I'm able to resize the control.But the bitmap remains of the same size.
Can you please tell me how to use StrechBlt() function in a much more detailed way.I tried but not getting it correctly.I'm new to to MFC.So please help me.
Thanking You in Advance and appriciating your kindness,
Robshere
|
|
|
|
|
No the StretchBlt() yoi gotta do on your own. You need to learn that.
PS: Ask an experienced programmer to explain you my answer
Greetings from Germany
|
|
|
|
|