|
I wrote an article about a chart control here[^]. Maybe it is helpfull for you ?
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
I have dowloaded a code from codeproject that adds a icon in systemtray and also a popup menu appears when a right click is made on the icon, but the if I do not select any option fron popup menu and click on some where else this popup menu do not disappear, why it is happening.
How it can disappear if i do not select any option and click some else where it should disappear.
Code snipts are here :
in header file
afx_msg void OnTrayNotify(WPARAM wParam, LPARAM lParam);
in message map
ON_MESSAGE(WM_TRAY_MESSAGE ,OnTrayNotify)
Notify function defenition
afx_msg void CTrayMinDlg::OnTrayNotify(WPARAM wParam, LPARAM lParam)
{
UINT uID;
UINT uMsg;
uID = (UINT) wParam;
uMsg = (UINT) lParam;
if (uID != 1)
return;
CPoint pt;
switch (uMsg )
{
case WM_LBUTTONDOWN:
GetCursorPos(&pt);
ClientToScreen(&pt);
OnTrayLButtonDown(pt);
break;
case WM_RBUTTONDOWN:
case WM_CONTEXTMENU:
GetCursorPos(&pt);
OnTrayRButtonDown(pt);
break;
}
return;
}
void CTrayMinDlg::OnTrayLButtonDown(CPoint pt)
{
MessageBox("You have clicked Left mouse Button ");
}
void CTrayMinDlg::OnTrayRButtonDown(CPoint pt)
{
//m_menu is the member of CTrayMinDlg as CMenu m_menu;
m_menu.GetSubMenu(0)->TrackPopupMenu(TPM_BOTTOMALIGN|
TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,this);
}
Regards.
|
|
|
|
|
|
Yes I used the same one. the popup menu apeared on clicking the tray icon do not disappear if i click on some other window. It remains there, and to make it disappear I have to select something from menu.
I want to hide the popup menu when I click on some other menu or in some other area
Regards.
|
|
|
|
|
MSDN library mentions this problem in the description of ::TrackPopupMenu function. In order to solve it, there is a recomendation to make the window foreground before TrackPopupMenu , and then to post a benign message immediately after TrackPopupMenu :
::SetForegroundWindow(hwnd);
::TrackPopupMenu(...);
::PostMessage(hwnd, WM_NULL, 0, 0);
Or, in case of MFC, inside a member:
SetForegroundWindow();
TrackPopupMenu(...);
PostMessage(WM_NULL);
Hope this will help.
-- modified at 10:11 Friday 2nd June, 2006
|
|
|
|
|
hai all's
whenever i execute the program in VC++(MFC(exe)) project the i have find
the error (could not execut the program:Invalid directory(win 32 error(267)
and this error is always for all my programs .
plz tell me where i am wrong.
mailing me
Yogi
|
|
|
|
|
Giving it just a try....
Its not clear from your posts what context are you working in.
Try and check the settings for the project . May be the path of the exe is not mapping currently. Go to project>settings>Debug>(set the path of the exe manually).
Does this help you?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
I am able to load(AfxLoadLibrary) the libavcodec dll in a VC7 Dialog based application. However I dont know how to call the functions within this DLL to encode/decode video. Has anybody done anything of this sort?
|
|
|
|
|
GetProcAddress for get the address of a function
whitesky
|
|
|
|
|
Ok, the def file says "avcodec_register_all @ 97 ; " so how would I use this with GetProcAddress?
"GetProcAddress(hModule, avcodec_register_all);" ??
Some kinda code snippets would be really helpful
Thanks anyway for replying
|
|
|
|
|
|
I have already had a look at that. But am unsure about the typedef thingy. Plus i am using the AfxLoadLibrary option.
This is what I am trying and it builds and executes fine
HMODULE hmodule;<br />
hmodule = AfxLoadLibrary("libavcodec.dll");<br />
if (!AfxLoadLibrary(_T("libavcodec.dll")))<br />
AfxMessageBox("failed to load");<br />
typedef void * (__stdcall *avcodec_register_all)();<br />
GetProcAddress(hmodule,"avcodec_register_all");<br />
void * objptr= avcodec_register_all();
I know this will sound dumb but if I wanted to encode video, I will have to typedef every function that I call fm the DLL?
-- modified at 4:45 Friday 2nd June, 2006
|
|
|
|
|
i write a sample i hope that helpful to you
<br />
<br />
<br />
typedef BSTR FAR (WINAPI *TESTFUNCTION)(HWND hWnd,TCHAR lpt[50]);<br />
TESTFUNCTION m_TestFunction;<br />
<br />
LibraryDll=LoadLibrary("Testdll.dll");<br />
<br />
m_TestFunction=(TESTFUNCTION)GetProcAddress(LibraryDll,"TestFunction");
<br />
m_TestFunction(pWnd->m_hWnd,NULL);
whitesky
|
|
|
|
|
Thank you for the code
But i am looking for code specific to FFMPEG and the libavcodec dll.
Any takers??
|
|
|
|
|
I write one example for you but i dont know whats your dll(exactly)
whitesky
|
|
|
|
|
You can learn more about FFMPEG from http://ffmpeg.mplayerhq.hu/[^]
Basically its an Audio/Video encoding/decoding thingy (OpenSource).You get dlls when you build ffmpeg and I am trying to use these DLLs in my VC++ application.Unfortunately, since its OpenSource, there isnt much documentation available online. Thanks for all your help though
|
|
|
|
|
Thanks for link but where your dll that has problem(exactly address)
and if you need to decode and encode you can see codeproject examples
whitesky
|
|
|
|
|
My dll has no problem. its in trying to use the functions of the dll that I get stuck . I dont know how to do it
Sorry for not having made that clear sooner.
|
|
|
|
|
ohh yes.ok wheres this dll file and also documets it
whitesky
|
|
|
|
|
You can download FFMPEG from http://ffmpeg.mplayerhq.hu/download.html[^]. It can be built using MINGW and MinSys
Instructions here
http://soenkerohde.com/tutorials/ffmpeg/
Or you can directly download a pre-built version of FFMPEG that has the dlls and the exe ready. The dll also has a def file but that's hardly helped since it mentions what functions are there but not the paramters
|
|
|
|
|
I am stuck in device context trouble.
Right now I am conclusion it will be worth to get directly
desktop dc for generic class.
If any body can suggest me way for passing device context to generic class
through thread function or getting desktop dc directly for drawing in generic class.
Here simulate is generic class and the nextpos function is doing lot of drawing stuff.and it needs device context,I have developed SDI application.
and used CView as base.
UINT CMy5CYLINDERView::ThreadFunc(LPVOID pParam)
{
CWnd *cwnd,*cwnd1;
cwnd1 = cwnd->GetWindow(1);
CDC* pDC = cwnd1->GetDC();
simulate* eng = (simulate*)pParam;
eng->nextpos(pDC);
// eng->nextpos(pszWindow);
return 0;
}
void CMy5CYLINDERView::support()
{
for(int ii = 0;ii <= 3;ii++)
{
x[ii] = AfxBeginThread(ThreadFunc,(LPVOID)&engine[ii]);
}
}.
|| ART OF LIVING ||
|
|
|
|
|
whats value cwnd(initialize)
i guess your problem is cwnd1 = cwnd->GetWindow(1);
whitesky
|
|
|
|
|
I tried solutions you given that day but it didnot worked.
How to get the window
CDC* pDC;// = this->GetDC();
HWND hwnd = ::GetActiveWindow();
HDC hdc = ::GetDC(hwnd);
pDC->SetOutputDC(hdc);
nextpos(pDC);
just now I tried longest path it also didnot worked.
I removed thread still I am able to get and pass the dc.
moment I assign anything to pDC it gives error
|| ART OF LIVING ||
|
|
|
|
|
CDC* pDC without value so you get one error pDC=GetDC();
this line has error pDC->SetOutputDC(hdc);
whitesky
|
|
|
|