|
Yes. We do not have any timeout setting on that operation
and I want to prevent terminateThread
|
|
|
|
|
vikrams wrote: We do not have any timeout setting on that operation
If you can not end the function of the 3rd party lib, gracefully ending your thread would not help anyway, as the lib would still continue working (and not release any resources).
So, there is a gap in the API of said lib, effectivly rendering it incompatible with threading.
Can you simulate that call usind other, smaller calls to the library?
You could start another process with your lib and call that. Terminating a process is guaranteed to release all resources aquired by that process - the OS sees to that.
Failure is not an option - it's built right in.
|
|
|
|
|
Hi !!!
Can any body know about to display string message ??
I know some of the method like..
1.acutpritnf("Inser point");
2.Cstring mystr;
mystr.load (IDS_MYBLOCK)
Any other trick or method do u know for displaying string message..
Thanking you.
|
|
|
|
|
Shah Satish wrote: mystr.load (IDS_MYBLOCK)
are you talking about displaying, or loading ?
what you do here is getting the string in the resource table and put it into your CString object.
you don't display it at all.
where do you want to display ? console ? static ? any control ? messagebox ?
please be clear when you ask a question
|
|
|
|
|
I want to display message on Autocad Prompt..Same as Acutprintf () function but here i have one string (IDS_MYBLOCK = Insert point )and i want to display this string on Autocad Prompt..
|
|
|
|
|
i don't know acutprintf(), but why not just trying this :
acutpritnf("Inser point");
Cstring mystr;
mystr.load (IDS_MYBLOCK);
acutprintf(mystr);
acutprintf("%s", mystr);
|
|
|
|
|
Using the DrawString function in GDI+ to render automatically wrapped text into a given rectangle, how do I indent the first line by a specific number of pixels?
|
|
|
|
|
i'm trying to build an ActiveX using MFC to control a device,
i got some problem when i tried to get the WM_USER message that send by the device,
i tried this code
LRESULT CALLBACK AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
CWnd* pWnd = CDialog::FromHandlePermanent(hWnd);
return AfxCallWndProc(pWnd, hWnd, nMsg, wParam, lParam);
}
LRESULT AFXAPI
AfxCallWndProc(CWnd* pWnd, HWND hWnd, UINT nMsg,
WPARAM wParam = 0, LPARAM lParam = 0)
{
LRESULT lResult;
lResult = pWnd->WindowProc(nMsg, wParam, lParam);
return lResult;
}
LRESULT CCertDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{ //CDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
LRESULT lResult = 0;
if (!OnWndMsg(message, wParam, lParam, & lResult))
lResult = DefWindowProc(message, wParam, lParam);
return lResult;
}
BOOL CCertDlg::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{ //CDialog::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
if (message == WM_USER+0)
return_pin(hwnd);
else if(message == WM_USER+1)
return_track2(hwnd);
//OnNotify(wParam, lParam, & lResult);
//else
//... // msg map related
return true;
}
LRESULT CCertDlg::DefWindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam)
{ //CDialog::DefWindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam)
if (m_pfnSuper != NULL)
return ::CallWindowProc(m_pfnSuper, m_hWnd, nMsg, wParam, lParam);
}
but its return error 2447 : missing function header (old-style formal list?) in afxwndproc function, can anybody help me?
its there any recomendation, another way to get the window message using mfc in C++?
thx
|
|
|
|
|
|
Try removing the default args of 0 from AfxCallWndProc.
|
|
|
|
|
I am doing the following things for neighbour child window updation in win32.
child window which contain listview control.
<code>
if(((LPNMHDR)lParam)->code == NM_CLICK)
{
iSelect=SendMessage(hList,LVM_GETNEXTITEM,-1,LVNI_FOCUSED);
if(iSelect==-1)
{
break;
}
index=iSelect;
ShowWindow(hWndinoutfiledir,SW_HIDE);
ShowWindow(hwndEncrypt,SW_HIDE);
ShowWindow(hwndSplit,SW_HIDE);
ShowWindow(hwndUpload,SW_HIDE);
ShowWindow(hwndTagEditorDlg ,SW_SHOW);
<big>::SendMessage(hwndTagEditorDlg ,IDC_HIDDEN_BTN,0,0);
</big>
UpdateWindow(hwndTagEditorDlg);
}
</code>
after click this below code is for updating child window. But it doesn't work.
LRESULT CALLBACK TagEditorProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
Utility util;
switch(message)
{
case WM_INITDIALOG:
if(_ProtectSet[index].listviewIndex==index)
{
SetDlgItemText(hDlg,IDC_EDIT_ARTIST,util.ConvertStringToWCHAR(_ProtectSet[index].artist));
SetDlgItemText(hDlg,IDC_EDIT_ALBUM,util.ConvertStringToWCHAR(_ProtectSet[index].album));
SetDlgItemText(hDlg,IDC_EDIT_YEAR,util.ConvertStringToWCHAR(_ProtectSet[index].year));
SetDlgItemText(hDlg,IDC_EDIT_COPYRIGHT,util.ConvertStringToWCHAR(_ProtectSet[index].copyright));
SetDlgItemText(hDlg,IDC_EDIT_AUTHOR,util.ConvertStringToWCHAR(_ProtectSet[index].author));
SetDlgItemText(hDlg,IDC_EDIT_GENRE,util.ConvertStringToWCHAR(_ProtectSet[index].genre));
SetDlgItemText(hDlg,IDC_EDIT_DESCRIPTION,util.ConvertStringToWCHAR(_ProtectSet[index].desc));
}
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_SAVE_TAG:
_ResideId3TagForSelectedFile(hDlg);
MessageBox(hDlg,_T("You file has been saved"),_T("encoder"),0);
break;
<big>case IDC_HIDDEN_BTN:
MessageBox(0,_T("HAY"),_T("HI"), 0);
::PostMessage(hDlg,WM_INITDIALOG,0,0);
break;</big>
}
break;
}
return FALSE;
}
can any body help me how should update my child window with null control or assigne values from object.
|
|
|
|
|
amitmistry_petlad wrote:
::SendMessage(hwndTagEditorDlg ,IDC_HIDDEN_BTN,0,0);
problem is that. you are sending the Ctrl ID in the message Field and trying to get in WM_COMMAND message!
better way of sending it is
PostMessage(hwndTagEditorDlg,WM_COMMAND,IDC_HIDDEN_BTN,0); and capturing that in WM_COMMAND wParam Parameter
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
A small clarification Alok:
you've omitted the notification code for the button which probably should be BN_CLICKED . The WPARAM parameter for the WM_COMMAND message contains both the control ID and the notification code. The code for simulating a user click on the IDC_HIDDEN_BTN should look like this:
::PostMessage( hwndTagEditorDlg, WM_COMMAND, MAKELONG( IDC_HIDDEN_BTN, BN_CLICKED ), NULL );
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: The code for simulating a user click on the IDC_HIDDEN_BTN should look like this:
offcourse.. you can also use SendDlgItemMessage!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
ThatsAlok wrote: u can also use SendDlgItemMessage
Very true, but that call chain will eventually call ::SendMessage() which is synchronous. Perhaps the idea was to have an asynchronous implementation.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: ery true, but that call chain will eventually call ::SendMessage() which is synchronous. Perhaps the idea was to have an asynchronous implementation.
you can make SendMessage Sync call Async by using ReplyMessage Api!
|
|
|
|
|
ThatsAlok wrote: you can make SendMessage Sync call Async by using ReplyMessage Api
Umm, not exactly...
It may be that we're talking about different levels of abstraction, but the call to ::SendMessage() always block until the message is "handled".
In a single threaded situation a call to ::SendMessage() would be similar to a function call, the message will never appear in the message queue. In this situation ::ReplyMessage() has no effect since it wouldnät make any sense.
When a thread sends a message to another thread with a call to ::SendMessage() , the sending thread will block until the receiving thread has handled the message. In this situation you may call ::ReplyMessage() to release the blocked thread before returning from the message handler in the receiving thread.
MSDN says: If the message was not sent through SendMessage or if the message was sent by the same thread, ReplyMessage has no effect.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
what should i write suppose i want to pass the extra parameter in sendmessage, like passing the selected index of the listview control.
|
|
|
|
|
amitmistry_petlad wrote: like passing the selected index of the listview control.
pass it in lParam parameter
|
|
|
|
|
Hi all,
I have created a thread and would like to know when the thread is called, is that the only time that the code within the thread would be executed? Or could one call the thread again to execute the code within the thread again. Hope this makes sense ...
void TestProc(void *par)
{
printf("Just testing some stuff\n");
}
...
int valTest = 1;
HANDLE handleTest;
handleTest = (HANDLE) _beginthread( TestProc,0,&valTest);
WaitForSingleObject(handleTest,INFINITE);
...
Many thanx in advance
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Read this article to get a better understanding of how to use worker threads: clickety[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanx Roger, the link has very useful information.
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Hi all
Can you pls help in Using Power management to Monitor UPS
Thanks & Reagrds
abhi
|
|
|
|
|
abhiramsss wrote: Can you pls help in Using Power management to Monitor UPS
Read the power management [^]section in MSDN. This section lists all the power management functions, messages, along with overview.
|
|
|
|
|
Hi
i am not understanding exactly how the bit fields implemented
if i create the following structure
struct word
{
unsigned int bit1 : 1;
unsigned int bit2 : 1;
unsigned int word3 : 16;
}
internaly how many bytes will be saved and is the 1 means 1 bit ?
|
|
|
|
|