|
Thanx for the input ThatsAlok and reply ..
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Programm3r wrote: The same question for achiving this in a messagebox.
To add to previous replies, you need customized message box for that.
Have a look at this article by Michael P. Mehl [^].
He has explained similar thing.
|
|
|
|
|
Thanx for the reply and help prasad
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Programm3r wrote: Lets say you use printf and you want to display a message with a counter, but the message must not repeat itself but the counter must.
Why don't you write a dedicated message box function that does this...
For eg:
void __cdecl ShowMsg( LPCTSTR lpctszTitle_i, const DWORD dwIconType_i, LPCTSTR lpctszMessage_i, ... )
{
va_list vaArgList;
va_start( vaArgList, lpctszMessage_i );
CString csMsg;
csMsg.FormatV( lpctszMessage_i, vaArgList );
MessageBox( AfxGetMainWnd()->GetSafeHwnd(),
csMsg,
lpctszTitle_i,
dwIconType_i );
va_end( vaArgList );
}
And call this function like wise
ShowMsg( _T( "Title" ),
MB_OK|MB_ICONINFORMATION,
_T( "My name is %s, my age is %d" ),
_T( "Nibu babu thomas" ), 27 ); You can customize this function for your need.
|
|
|
|
|
Hi Nibu babu thomas,
Thanx for the reply and the code snippet, I'll see what I can do ..
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
i have to insert a string between "init" and "start" in a file. how to write this. is there any function to write in the middle of the file
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
1) do you know the exact structure of the file content ? is it text or binary ? how are shaped the internal elements ?
2) what have you already tried ?
3) what's the problem with the previous answers[^] you got ?
couldn't you just follow the same thread ?
|
|
|
|
|
No, this is not possible directlt. You will need to read your file in memory (for example in a string) and insert the data there. Then you will need to write everything to the file again.
|
|
|
|
|
i want to know about the tcp flow in network simulator so that i could make changes in desired place.
One more thing after change in code of network simulator each time we have to configure it then install it or there's some other way out.
please reply me soon...
Please reply me soon.......n u can ask me any questions in c/c++/.net
|
|
|
|
|
chandni chi wrote:
Please reply me soon.......n u
i can't understand your requirement.. could you tell us that in bulleted point.. that may be much easier
"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
|
|
|
|
|
Hie All,
I have created a thread which calls a function. Sometime this function may get hung. In such situation I need to termintate my thread gracefully. Is there any good solution exists?
Note: the function is from third party library, I can not change or control it.
|
|
|
|
|
vikrams wrote: I have created a thread which calls a function. Sometime this function may get hung. In such situation I need to termintate my thread gracefully.
If your thread hangs you've passed the point of ending the thread gracefully since you cannot communicate with it. Are you sure that this third-party-lib is thread safe and doesn't produce deadlocks if called from different threads? If it is thread safe it would probably say so in its documentation.
Try a single threaded solution and see if it works.
You're not using COM, are you?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Third party lib is thread safe. here this function hangs bcoz of some long time taking operation in rare cases. And we don't want to wait for that operation ...
|
|
|
|
|
vikrams wrote: this function hangs bcoz of some long time taking operation in rare cases. And we don't want to wait for that operation
Sounds like a dangerous situation. There's only one way to end the thread and that's to call ::TerminateThread() , but that's not really recommended. See here[^] for reasons why.
No possibility for setting a timeout on the lengthy operation?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
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.
|
|
|
|
|