|
This is the third time you have beaten me to it, and i forgot to mention CServerDlg as well
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Steve
|
|
|
|
|
Using MFC objects in seperate threads is not always a good idea due to nature of the library.
Instead define a struct
struct ThreadData {
};
when you create the thread
ThreadData *pData = new ThreadData;
CreateThread(NULL,0,ThreadFuncName,pData,0,&dwThreadId);
Then in the ThreadFuncName function
...ThreadFuncName(LPVOID lpVoid)
{
ThreadData *pData = (ThreadData*)lpVoid;
return 0;
}
And if u wish to communicate to some windows then use HWND's not CWnd's to send messages
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
hi all
i want to generate the code 39 barcode.i had search on the internet but could not find any algo for making the code 39 bar code any link u people visited or known.
ddd
|
|
|
|
|
|
Don't know much about bar codes but i saw this[^] once
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
How about using a font?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi,
I want to pass the reference(test) of the interface (ITest) define inside the COM DLL (TestCom.dll) in my application function.Example
GetMerchItemType( TestComLib::ITest &test, int Temp)
However I am facing the following error.
error C2653: 'TestComLib' : is not a class or namespace name
error C2061: syntax error : identifier 'ITest'
Can you please help me resolve this error.
Thanks
-- modified at 3:42 Friday 10th March, 2006
|
|
|
|
|
You have to import the typelib of the testcom.dll into your project.
|
|
|
|
|
Search for the definition of ITest . Is it enclosed in a namespace called TestComLib ? I assume you're using #import . If you are you'll need to look in the .TLH and .TLI files.
Steve
|
|
|
|
|
i want to make popu menu which show on right click of mouse how can i done it.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Add a menu, then add a submenu to the menu.
The use Classwizard to add a Message Handler for WM_RBUTTONCLICK
writting from memory s please confirm
In Handler
...::OnRclick()
{
DWORD dwMousePos = GetMessagePos();
CPoint pt(HIWORD(dwMousePos),LOWORD(dwMousePos));
CMenu menu;
menu.LoadMenu(IDR_MENU1);
CMenu *pSubMenu = menu.GetSubMenu(0);
pSubMenu->TrackPopupMenu(...);
}
hope it helps
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
<br />
VOID APIENTRY DisplayContextMenu(HWND hwnd, POINT pt) <br />
{ <br />
HMENU hmenu;
HMENU hmenuTrackPopup;
<br />
<br />
if ((hmenu = LoadMenu(hinst, "ShortcutExample")) == NULL) <br />
return; <br />
<br />
<br />
hmenuTrackPopup = GetSubMenu(hmenu, 0); <br />
<br />
<br />
TrackPopupMenu(hmenuTrackPopup, <br />
TPM_LEFTALIGN | TPM_RIGHTBUTTON, <br />
pt.x, pt.y, 0, hwnd, NULL); <br />
<br />
<br />
DestroyMenu(hmenu); <br />
} <br />
|
|
|
|
|
its done do't west ur time.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
for show menu I suggestion you can use event WM_CONTEXT_MENU
void CAnswerView::OnContextMenu(CWnd* pWnd, CPoint point)
{
CMenu menu;
menu.LoadMenu(IDR_MAINFRAME);
CMenu *m_ContexMenu=menu.GetSubMenu(0);
m_ContextMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,point.x,point.y,AfxGetMainWnd());
}
|
|
|
|
|
hello!
I asked this question some days ago, but got no answer.
I'm stil searching for a good profiler for VS2005 Pro.
Can sombody recommend one?
|
|
|
|
|
I don't think there is a free one available, and it doesn't look like Compuware is releasing a free one for VS2005 like they did for 2003.
For a recent project, I ended up using a demo version of AQTime. A little bit quirky to use at first, but it works good once you know how to use it. Only works for 15 days.
"My dog worries about the economy. Alpo is up to 99 cents a can. That's almost seven dollars in dog money" - Wacky humour found in a business magazine
|
|
|
|
|
Hi !
In my application, I'm making a call to a function provided by a third party library. Unfortunately, this call is crashing in some situations (which I have no way to detect prior to calling the function).
I tried to put the call into a try{} catch{} block, but it didn't work. Here is what I did :
try {
api_call(mydata);
}
catch (...)
{
// error
}
the problem is that my app keeps crashing in the 'try' block, which is something I don't understand. I'm compiling with expection support.
Any hint ?
Thanks !
Jerome
|
|
|
|
|
<br />
__try <br />
{<br />
api_call(mydata);<br />
}<br />
__except ( expression )<br />
{<br />
}<br />
|
|
|
|
|
Hi !
Thanks for your answer, but it seems __try and __except are MS specific keyword. I'm compiling in a linux environnement...
Any onther hint ?
Thanks !
Jerome
|
|
|
|
|
You could give more information, here is my guess.
If you are calling a C-function from a C++-class, you have to do this in the third party .h-file:
Surround all function declarations with this code:
#ifdef __cplusplus
extern "C" {
#endif
// the original function prototypes
#ifdef __cplusplus
}
#endif
Else, the first parameter of all function calls will be the this pointer. And that will make the funcion call to crash...
|
|
|
|
|
Hi thanks for your answer.
I'm actually calling a C++ function from a C++ class. The call to the function works in most cases, but crashes in some specific cases.
Jerome
|
|
|
|
|
Chenxing's solution will work - As much as catching an unexpected exception will ever work. Here's how to do it:
__try
{
api_call(mydata);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
}
Note that catching an unexpected exception is never a good idea - For example the exception might have occurred while a node was being linked into a linked list but has only been half linked in. Or perhaps after a CRITICAL_SECTION was entered but before it is released. Once an unexpected exception occurs the state of the application is suspect.
I realize you may have no choice but nethertheless beware - You may end up creating more problems for yourself.
Steve
I just noticed the comment where you said you're programming on Linux - Sorry.
-- modified at 4:22 Friday 10th March, 2006
|
|
|
|
|
Hi, me again!?
Sorry to be such a pain in the a$$, but was wondering if anyone knows if it is possible to control a powerpoint presentation with a c++ program?
I have been building a remote control application for the computer (eventually, I want to add a USB-serial adapter, so that I can connect a remote receiver to USB...). So far, I can control Winamp, iTunes, WMP and BSPlayer (the only programs I really use for multimedia) and when theyre not running, it will control windows volume. It also has an overriding mute, that will always mute everything.
I was thinking the next/prev track buttons could be used to control a powerpoint presentation, as this could be useful for the future... but its proving difficult to find any information on it...
Does anyone have any ideas?
Thanks,
Mark
|
|
|
|
|
Try this[^]. PowerPoint's fairly easy to control - I've done it a lot.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|