|
I have seen the sample code for my use. But I forgot to save it. Now I cannot remember its location.
The code implements a list control, almost as the same as in VC6 under Options -> Paths -> Paths:. The user can create a new item by clicking the rectangle with a star, and delete it with the red cross. He can also move an item up and down with the other Up- and Down arrows.
Who can plz help me to find it? Thanks!
|
|
|
|
|
|
Hey,
does anyone know what message is being sent when the mousepointer is over a tab in a tabcontrol? My problem is that the things I have drawn inside a tab is flickering when I move the mouse over the tabs. Might be some message painting the tabs yellow in WinXP? When I switch the tablayout to buttons the problem disappears...
Cheers
|
|
|
|
|
I writing my menu by LoadMenuIndirect function. I saw my menu with Debug mode but I dont' see it with Release mode ! Why ?
|
|
|
|
|
How are these right hand corner notifications are launched by msn or McAfee or others to name a few?
|
|
|
|
|
|
Hi, this may be a stupid question, but could someone please tell me how to start a help file (which is in html format by the way), from MFC? I've tried both WinExec and CreateProcess, but neither work. Secondly, if the help file gets big enough to where i can make a .chm out of it, could i use the same method?
|
|
|
|
|
For compled help files (.chm) use the function HtmlHelp(
HWND hwndCaller,
LPCSTR pszFile,
UINT uCommand,
DWORD dwData) ;
It's really easy to use. I personally wouldn't use pure .html files - .chm is more user-friendly, providing easy navigation.
Btw: That function is declared in htmlhelp.h, and you need to link to htmlhelp.lib to get it work.
|
|
|
|
|
|
One thing you may have to consider is that you will have to heavily customize certain parts of tyour app if you want the help to be fully integrated, such as having a "Help" button on a dialog, context sensitive help etc.
You will need to override
virtual void CWinApp::WinHelp( DWORD dwData, UINT nCmd = HELP_CONTEXT );
as well as some of the other help messages
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
|
|
|
|
|
Hi, I am writing a modal dialog app without any MFC. I am painting the window
myself by handling the WM_PAINT messages (using a dc in mem to draw to and then using BitBlt).
The problem is when the dialog is moved very rapidly around the screen it
sometimes stops being drawn correctly. The dialog is then drawn as garbage like parts of the desktop, or is drawn only partially correctly.
Am I allowed to draw to areas of the dc in mem that will later be "covered" by edit boxes or static bitmaps (defined in the dialog resource)? Is this
the problem?
Here's the relevant code in the dialog proc:
case WM_PAINT:<br />
{<br />
BeginPaint(hWnd, &ps);<br />
Paint(hWnd, &ps);<br />
EndPaint(hWnd, &ps);<br />
break;<br />
<br />
<br />
}<br />
<br />
case WM_ERASEBKGND:<br />
return (LRESULT)1;
<br />
<br />
case WM_CTLCOLOREDIT:<br />
{<br />
SetBkMode((HDC)wParam,TRANSPARENT);<br />
SetBkColor((HDC)wParam,RGB(192,192,192));<br />
SetTextColor((HDC)wParam,RGB(0,0,0));<br />
return (BOOL)Back; <br />
}
Code for painting:
static void Paint(HWND hWnd, LPPAINTSTRUCT lpPS)<br />
{<br />
RECT rc;<br />
HDC hdcMem;<br />
HBITMAP hbmMem, hbmOld;<br />
HBRUSH hbrBkGnd;<br />
<br />
<br />
GetClientRect(hWnd, &rc);<br />
<br />
<br />
hdcMem = CreateCompatibleDC(lpPS->hdc);<br />
<br />
<br />
hbmMem = CreateCompatibleBitmap(lpPS->hdc,<br />
rc.right-rc.left,<br />
rc.bottom-rc.top);<br />
<br />
<br />
hbmOld =(HBITMAP)SelectObject(hdcMem, hbmMem);<br />
<br />
<br />
hbrBkGnd = CreateSolidBrush(GetSysColor(COLOR_WINDOW));<br />
FillRect(hdcMem, &rc, hbrBkGnd);<br />
DeleteObject(hbrBkGnd);<br />
<br />
<br />
<br />
<br />
<br />
SetBkMode(hdcMem, TRANSPARENT);<br />
<br />
<br />
HPEN MyPen;<br />
HBRUSH MyBrush;<br />
<br />
MyPen=CreatePen(PS_SOLID,1,RGB(96,96,96));
MyBrush = CreateSolidBrush(RGB(96,96,96));<br />
SelectObject(hdcMem,MyPen);<br />
SelectObject(hdcMem,MyBrush);<br />
<br />
Rectangle(hdcMem,0,0,600,600);<br />
<br />
MyPen=CreatePen(PS_SOLID,1,RGB(0,0,0));
MyBrush = CreateSolidBrush(RGB(192,192,192));<br />
SelectObject(hdcMem,MyPen);
SelectObject(hdcMem,MyBrush);<br />
<br />
Rectangle(hdcMem,5,5+17,546,385+17);
<br />
MyPen=CreatePen(PS_SOLID,1,RGB(192,0,0));<br />
MyBrush=CreateSolidBrush(RGB(192,0,0));<br />
SelectObject(hdcMem,MyPen);<br />
SelectObject(hdcMem,MyBrush);<br />
<br />
Rectangle(hdcMem,10+xBuggy*40,10+(9-yBuggy)*40,20+xBuggy*40,20+(9-yBuggy)*40);
<br />
MyPen=CreatePen(PS_SOLID,1,RGB(0,0,0));
SelectObject(hdcMem,MyPen);
<br />
int xPos=15;<br />
int yPos=15;<br />
<br />
while(xPos<=570)
{<br />
MoveToEx (hdcMem, xPos, 15+17, 0);<br />
LineTo (hdcMem, xPos, 375+17);<br />
xPos=xPos+40;<br />
}<br />
<br />
<br />
while(yPos<=400)
{<br />
MoveToEx (hdcMem, 15,yPos+17, 0);<br />
LineTo (hdcMem, 535, yPos+17);<br />
yPos=yPos+40;<br />
}<br />
<br />
<br />
<br />
<br />
DeleteObject(MyPen);<br />
DeleteObject(MyBrush);<br />
<br />
<br />
<br />
BitBlt(lpPS->hdc, <br />
rc.left, rc.top,<br />
rc.right-rc.left, rc.bottom-rc.top,<br />
hdcMem,<br />
0, 0,<br />
SRCCOPY);<br />
<br />
<br />
SelectObject(hdcMem, hbmOld);<br />
DeleteObject(hbmMem);<br />
DeleteDC(hdcMem);<br />
<br />
}
|
|
|
|
|
Hi
I am writing a program to process multiple independent datas. This program is very processing intensive. So i am wondering if multi threading would help to reduce the amount of processing time.
I have doubts over it because I have only one processor. So wouldn't the time taken for the processing to be the same in multithreading case (or even more due to addition overhead)?? If it helps to cut down the time taken, how does it do it with only one processor?? Can someone please enlighten me ??
Thank you very much for the kind attention !!
|
|
|
|
|
boon kian wrote:
So wouldn't the time taken for the processing to be the same
Maybe, but your App stays responsive.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
boon kian wrote:
So i am wondering if multi threading would help to reduce the amount of processing time.
Not using a single CPU. Quite the opposite; the overhead will make the processing slower.
If the process is e.g. I/O bound the percieved speed of the application might benefit greatly from multithreading, but the total CPU time used will always be greater for a multithreading program than a singlethreded program (even if by such a small amount of time that one wouldn't even bother to try measure it).
|
|
|
|
|
I agree with the above posts, but there are some things you may want to consider...
First, the user usually despises apps that appear "frozen" and unresponsive. If you go calling a time-consuming data reduction function from the main UI thread, your app will appear to "hang" during processing. If you don't pump update messages and redraw the screen, the user can slide another window over your app, and your app will just appear blank and dead.
However, don't go off spawning 20 threads to process your stuff either! I would definately consider putting the data reduction algorithms in a seperate "worker" thread, and pumping progress messages from within it. Although you won't gain any speed (or may actually lose some), it is most likely in the best interest of the user.
This will keep your UI happy and responsive, and the world will be a better place
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
As has already been mentioned it could be slower, but you will find that the single CPU will be running at 100% all the time, whereas a single threaded app could be waiting for some input/event whilst trying to process the data.
If the data does lend it's self to multithreading then do it, you never know you may get a multi cpu machine, I do have a 2 cpu machine, but be careful as there could be an interaction between processing data on each of the cpu's that could cause the prog to hang/crash
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
Ted Ferenc wrote:
whereas a single threaded app could be waiting for some input/event whilst trying to process the data.
umm, don't you mean a multi-threaded app?
A single thread will cycle through the processing algorithm and not return until complete. The multi-threaded app can process the data AND recieve messages from the user.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
What as I was trying to say was on a single CPU machine, multithreaded, the CPU usage will probably be 100% but if only one thread is used it could end up waiting for some event therefore it will not use 100% CPU time, but there is an overhead of course. But if multithreaded the likelyhood is that one thread may be waiting but another should be processing.
I fink my grammer was not correct, sorry
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
how can I capture the content of a fullscreen directx window.
I have absolutely no idea how this could be done.
thanks
widi
-
|
|
|
|
|
Is it "your" window? Then I believe it should be as simple as GetDC for the display surface and blit it to a bitmap.
|
|
|
|
|
No, it could be any (I guess mostly) fullscreen-game-windows.
-
|
|
|
|
|
|
Hy.
I'm trying to create a program that needs plugins. My problem is that i found quite a few methods of creating plugins, and i don't know wich method to use (wich one is better).
Anyway, here's what i need to be able to do:
- plugins must be able to access a list of data from the main program (for modifying it)
- plugins can show their own dialogs when executed
- i'd like to implement a Plugin Config system like Winamp3 has (there's a tree with each plugin as a treenode, and when you select one of them, the right side shows the plugin's config dialog)
- plugins should be able to add new commands to the main menu and toolbar of the application that loads them.
- also, the user should be able to select wich plugins not to load
So, if anybody has a good ideea on how can i make this all, please help me.
|
|
|
|
|
I have written a plugin system for a game launcher, and it works very fine and very similar to the one in Winamp2. The exe loads all .dll files in the plugin directory using LoadLibrary() . Of yourse you can make it selectable which files should be loaded.
In order to access data from the main program I have an exported function in my DLL that accepts a pointer parameter, here's an example:
extern "C" __declspec(dllexport) void _stdcall OnJoinServer(const hlla_SERVER* server)
Before you can user any exported functions I find their address in the DLL using GetProcAddress()
To bring up a configuration dialog I export e function in my DLL called OnConfigure ; the exe calls this function if the user clicks on "Configure" in the main app. Inside the OnConfigure function in the DLL I simply open the configuration dialog using DoModal() .
When my app finishes I close all handles to the plugins (dlls) with FreeLibrary()
regards
Greg
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Well, i've found a system that does the loading/unloading for me (look at http://www.codeproject.com/dll/plug-in.asp).
My problem is that if i create MFC Extension DLLs, the LoadLibray and FreeLibrary functions don't work. So, i didn't find any way yet to use MFC classes in my DLLs.
I need some help with this part, as this i think is the most important one (as my DLLs will use MFC classes)
For the shared memory part (the list of data that plugins have to work with) i think i can send a pointer to that data (each plugin has a function that asks for that pointer), if anybody has a better ideea, please tell me.
For the Winamp like configuration i suppose that's not that extremly important, so i could leave it for a latter time (or leave it out completely from the project), so for now each plugin shows its own dialog with configurations.
|
|
|
|
|