|
Depending on what is different between the 3, you could always write your code such that the interfaces are the same for all of them and you use some configuration setting to determine which implementation gets created during runtime.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
You can build this all into a single project, and then compile it differently for each client. The approach I've used in the past is something like this:
#define CUSTOMER_ALPHA 0
#define CUSTOMER_BETA 1
#define CUSTOMER_GAMMA 2
#define CUSTOMER CUSTOMER_BETA
class MyDialog : public CDialog {
#if CUSTOMER == CUSTOMER_ALPHA
enum { IDD = IDD_CUSTOMER_ALPHA };
#elif CUSTOMER == CUSTOMER_BETA
enum { IDD = IDD_CUSTOMER_BETA };
#elif CUSTOMER == CUSTOMER_GAMMA
enum { IDD = IDD_CUSTOMER_GAMMA };
#endif
}; You create separate resources for the dialog for each customer: IDD_CUSTOMER_ALPHA , IDD_CUSTOMER_BETA , and IDD_CUSTOMER_GAMMA . I'm assuming here that the dialogs for each of the customers are similar enough that you can use a single class to support all three. Within the MyDialog code you can look at the CUSTOMER value in case there are differences you need to know about.
Software Zen: delete this;
|
|
|
|
|
Greetings everyone,
I'm working on a screensaver that I'd like to use GDI+ with (to display alpha-blended images, etc). What I'm trying to accomplish is to paint the desktop with background images, so to handle this I'm calling EnumDisplayMonitors from within my message pump (in the WM_PAINT case).
I'm correctly getting the callback against my MonitorDisplayProc, and since I bracket the EnumDisplayMonitors call with GetDC(null), ReleaseDC(null, hdc), I'm able to pass the DC that (should) correspond to the virtual desktop to EnumDisplayMonitors.
Inside of MonitorDisplayProc, I'm able to take the provided hdcMonitor and lprcMonitor vars and paint to the relevant display via FillRect(hdcMonitor, lprcMonitor, (HBRUSH) GetStockObject(BLACK|GRAY|WHITE_BRUSH)). So far, so good.
Now, when I use the hdcMonitor object to create a GDI+ Graphics object, it seems to work okay for the primary monitor. I can load an Image from disk and draw to the primary screen just fine.
However, when my MonitorDisplayProc gets the callback for my second display, graphics.GetVisibleClipBounds(&clipRect) is returning a {0,0,0,0} rect. Appropriately, graphics.isVisible(...) is also failing.
Reading the MSDN docs for GetVisibleClipBounds makes me believe something in the hdcMonitor object is incorrect, but I'm having a hard time proving it - I'm trying to fetch the hdcMonitor's bounding box via GetRandomRgn(hdcMonitor, hRgn, SYSRGN) but that is returning 0's when I pass it into region.GetBounds(...). This makes me think I'm misunderstanding something about graphics's world/page/device conversion, but I'm not sure.
There's lots of documentation on the web about C# using forms, but I'm having a rough time finding anything that directly references this problem either via Google or MSDN.
Does anybody out there have any idea why Gdiplus::Graphics would be reading a HDC 'improperly' as specified above? Any help would be *greatly* appreciated.
|
|
|
|
|
Hi, I am trying to write a fullscreen game... and I have a question about the message loop
I am curently using the following form:
<br />
while(msg.message!=WM_QUIT)<br />
if(PeekMessage(&msg,0,0,0,PM_REMOVE)){<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
else Render();<br />
whitch ain't so bad for the momment, but in future it's gonna have multiplayer
and user input,and other stuff.I saw in Quake3's source the loop was way diffrent.
And now the question:
Can anyone(hwo had previously worked whit somethings like that ...hopefully)give me an ideea
about how the message loop should be like.
Thnaks
|
|
|
|
|
The Quake 3 source isn't that much different (and neither is most other PC games message loops):
WPARAM MainLoop()
{
MSG msg;
while (1)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
}
}
return msg.wParam;
}
It really isn't that much different than what you have.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi,
i have another stupid question
In my MDI project i added a new MFC class of type Base-type CDialog.
Then i put some buttons on it and by a keystroke on a MDI Child Window
i execute this code :
if(nChar == 112) { // If F1 Key
CWnd *Con = GetFocus(); // the selected Control
WinTEdit Help(this);
if(!Help.Create(IDD_WINTEDIT,this))
int error = 1;
Help.ShowWindow(SW_SHOW);
}
Help.Create return always false
In my source code of the WinTEdit(CDialog) i doesn't change anything
It's certainly a little config that crashes the creation
Thanks
|
|
|
|
|
|
I think WinTEdit is CDialog if you run this code what happens?
<br />
<br />
if(nChar == 112) {
CWnd *Con = GetFocus();
<br />
WinTEdit *Help;<br />
Help=new WinTEdit(this);<br />
Help.ShowWindow(SW_SHOW);<br />
}<br />
<br />
<br />
WinTEdit::WinTEdit(CWnd* pParent )<br />
: CDialog(WinTEdit::IDD, pParent)<br />
{<br />
Create(WinTEdit::IDD,pParent);<br />
}<br />
|
|
|
|
|
WinTEdit::WinTEdit(CWnd* pParent /*=NULL*/)
: CDialog(WinTEdit::IDD, pParent)
{
Create(WinTEdit::IDD,pParent);
}
causes the same problem
It's seriously possible to open a CDialog in a MDI-Project, or not?
Or isn't it possible to open a CDialog with a "CFormView"-Parent?
So that only the mainform could open the CDialog...
Thanks
-- modified at 3:46 Monday 30th October, 2006
|
|
|
|
|
After call to thread function and then we process some job in main program.
How to check from main program, the thread function is working or not.
|
|
|
|
|
If you still have a handle to the thread, you can call GetExitCodeThread to see if it's still running. If you want to wait for it to finish running, pass the handle to one of the wait functions (e.g. WaitForSingleObject ).
|
|
|
|
|
I use this function..
AfxBeginThread(Thread,this);
for start thread.
Please advise me how to get handle to the thread.
|
|
|
|
|
Something like
CWinThread* pThread = AfxBeginThread(...);
HANDLE hHandle = (HANDLE)pThread;
|
|
|
|
|
Max++ wrote: Please advise me how to get handle to the thread.
They hide that information in the documentation[^]
led mike
|
|
|
|
|
led mike wrote: They hide that information in the documentation[^]
he he he
"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
|
|
|
|
|
Hi,
I am trying to convert wide character string to ASCII string. I get WideCharToMultiByte() API function to do this task. Now when I am using this function it gives me “ERROR_INVALID_PARAMETER” error. Can I know where I am going wrong?
wchar_t* wStr = L"test string";<br />
int wLen = ::wcslen(wStr);<br />
char* aStr = NULL;<br />
int aLen = ::WideCharToMultiByte(CP_ACP,0,wStr,wLen,NULL,0,NULL,NULL);<br />
int eCode = ::WideCharToMultiByte(CP_ACP,0,wStr,wLen,aStr,aLen,NULL,NULL);
|
|
|
|
|
From the top of my head:
priyank_ldce wrote: char* aStr = NULL;
aStr must point to a valid buffer to recieve the converted multibyte string.
|
|
|
|
|
If I want to use DirectX for writing commercial apps, do I have to pay Microsoft for that. Will it be OK if I buy only Visual Studio 6.
|
|
|
|
|
Using DirectX for a commercial application does not require paying a license.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Daniel Kanev wrote: do I have to pay Microsoft for that
No. Last time I checked, you have to pay ME to do that
|
|
|
|
|
Hi all,
I've a button to move to the next point in a plot
when the button is pushed.
The matter is that i must click on the button many times
if i wanna continue to pass to the next point in the plot,
while i would like to obtain this keeping clicked the button.
How can i do that ?
Thanx in advance,
Desmo16.
|
|
|
|
|
OnButtonDown:
start a timer
OnTimer:
move the selection to the next point
OnButtonUp:
stop the timer
|
|
|
|
|
I suggest you override CButton and create a button class that repeats the BN_CLICKED event.
Have a look at Joe Newcomer's article here[^] for tips on how to accomplish this behaviour.
You could even have more than one timer event to make the BN_CLICKED events generated with higher frequency if the button is kept down for a longer time.
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Desmo16 wrote: The matter is that i must click on the button many times
if i wanna continue to pass to the next point in the plot,
while i would like to obtain this keeping clicked the button.
How can i do that ?
Set timer and send BN_CLICKED message from it!
"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
|
|
|
|
|
hi
I want to get the Windows TaskBar Height and Width in MFC.
Any API's are welcome
Thanx in advance
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|