|
Assuming you put it in the right place on the target machines, you are encountering some other problem. Things to check:
- OnInitDialog() is actually not being called (try putting a message box at the start of it and confirm that it doesn't appear on the problem machines)
- The problem machines aren't running Win9x
- This is a normal dialog (not a file dialog / print dialog / other common dialog)
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
Shog,
1. OnInitDialog() is actually not being called (try putting a message box at the start of it and confirm that it doesn't appear on the problem machines)
It is true that OnInitDialog() is not called on the problem PCs, the MessageBox I put in the beginning of OnInitDialog()proves that
2. The problem machines aren't running Win9x
All the test machines are either W2K or WXP
3. This is a normal dialog (not a file dialog / print dialog / other common dialog)
This is a single page dialog that has some edit boxes and check boxes.
I have tried "use MFC in a Static Library" in the project Setting->General->Microsoft Foundation Classes. And also tried copy the mfc42.dll to the exe folder of the problem machine. I am not sure if that is the right way to do it as you mentioned.
Thanks
|
|
|
|
|
I'm afraid i'm out of ideas then. I suggest you try to narrow down the problem by producing a stand-alone program with a simple dialog, verifying that this works on the problem machines, and then gradually morphing the code towards that which doesn't work until you are able to break it. Then work backwards, eliminating superfluous code until you can determine the source of the problem (or post it here).
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
Write a program that generates a random sequence of 300 rolls using the hidden Markov model for the occasionally dishonest casino. Your program should output a sequence of 300 rolls and a sequence of 300 states (Fair or Loaded). The loaded has probability of 0.5 for a six and 0.1 for the numbers 1 to 5. Assume the casino dealer switches from a fair die to a loaded die with a probability of 0.05 and probability of switching back is 0.1. Assume the dealer starts with a fair die.
|
|
|
|
|
Oluwaseyi Bamigbade wrote: Write a program...
Done. Thanks for playing.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
And what about the budget?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: And what about the budget?
For you free.
|
|
|
|
|
Hamid. wrote: For you free
OK.
Done.
He can download it on the website
www.cpallini.freeproducts.com
(it maybe down for a while due to funds shortage... )
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
i don't free!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Sounds like one of those "urgent" questions to me.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Anyone know of a good tutorial/code sample that demos how to make a proper popup window, something like you'd use to make your own menus, or drop-down for a combo-box like control? I'm having some issues trying to do this, and I'd like to find something that does it correctly that I can look at.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
This one is about ComboBox[^] but why so secretive?
Jim Crafton wrote: I'm having some issues trying to do this
Issues like? It's difficult to find anything specifically about your secret issues.
led mike
|
|
|
|
|
Yeah that was a bit vague I suppose. But I've got to be careful, in case they see me...
Anyhow it was problems related to activation - which window was getting highlighted (or not). Turns out I was forgetting to forward the msg along to the default wndproc. I think I have it sort of fixed now.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Assuming MFC...
Attempt #1: You can CreateEx() with WS_POPUP style but that will deactivate your app while the popup is up and your popup window will show up in the taskbar.
Attempt #2: You can give it an extended style of WS_EX_TOOLWINDOW to prevent the taskbar entry but that doesn't solve the deactivated application problem.
The solution is to avoid WS_POPUP and use CreateEx() with an extended style of WS_EX_TOOLWINDOW, style of WS_CHILD, and make the parent the desktop window.
There are other issues to contend with but that will get you a window that can extend beyond the window of your application.
Hope that helps.
|
|
|
|
|
Thanks for the pointers! Yes that helped.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
I have successfully used SetDIBitsToDevice to copy a bitmap to the current job's window on the screen; but I cannot find a function GetDIBitsFromDevice. Please how could I copy the whole of the user area (i.e. not the edging) of the current job's window onto a bitmap?
|
|
|
|
|
Anthony Appleyard wrote: Please how could I copy the whole of the user area (i.e. not the edging) of the current job's window onto a bitmap?
If you are using MFC, try something like:
CDC dc;
HDC hdc = ::GetDC(wnd->m_hWnd);
dc.Attach(hdc);
CDC memDC;
memDC.CreateCompatibleDC(&dc);
CRect r;
wnd->GetClientRect(&r);
CSize sz(r.Width(), r.Height());
CBitmap bm;
bm.CreateCompatibleBitmap(&dc, sz.cx, sz.cy);
CBitmap *oldbm = memDC.SelectObject(&bm);
memDC.BitBlt(0, 0, sz.cx, sz.cy, &dc, 0, 0, SRCCOPY);
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks; but I want to copy the screen into a bitmap specified by a BITMAPINFO and an array of bytes, using the plain old Windows API functions.
|
|
|
|
|
Anthony Appleyard wrote: copy the screen into a bitmap specified by a BITMAPINFO and an array of bytes, using the plain old Windows API functions
RECT rct;
HWND wnd = ::GetDesktopWindow();
::GetWindowRect(wnd,&rct);
HDC hDC = ::GetDC(NULL);
int iWidth = rct.right - rct.left;
int iHeight = rct.bottom - rct.top;
BITMAPINFOHEADER BMI;
BMI.biSize = sizeof(BITMAPINFOHEADER);
BMI.biWidth = iWidth;
BMI.biHeight = -iHeight;
BMI.biPlanes = 1;
BMI.biBitCount = 32;
BMI.biCompression = BI_RGB;
BMI.biSizeImage = 0;
BMI.biXPelsPerMeter = 0;
BMI.biYPelsPerMeter = 0;
BMI.biClrUsed = 0;
BMI.biClrImportant = 0;
BYTE *pSrcBits;
HBITMAP hbmSrc = ::CreateDIBSection(hDC, (BITMAPINFO *)&BMI,DIB_RGB_COLORS, (void **)&pSrcBits,NULL,0);
HDC dc = ::CreateCompatibleDC(NULL);
HBITMAP hbm = (HBITMAP)::SelectObject(dc, hbmSrc);
::SetStretchBltMode(dc, HALFTONE);
::BitBlt(dc,0,0,iWidth,iHeight,hDC,0,0,SRCCOPY);
HBITMAP hOld = (HBITMAP)::SelectObject(dc, hbm);
::SelectObject(dc,hOld);
::ReleaseDC(wnd,hDC);
::DeleteDC(dc);
::DeleteObject(hbmSrc);
Best Wishes,
-David Delaune
|
|
|
|
|
|
|
void main()
{
char *buffer = new char[];
int n, a=5, b=3;
n = sprintf (buffer, "%d plus %d is %d", a, b, a+b);
printf ("[%s] is a %d char long string\n",buffer,n);
delete [] buffer; // THIS LINE THROWS an error
}
I need to have a dynamic array as shown, if i try to clean up the array, throws an exception. Any help will be great. Has to be in C++ only, no MFC please.
I am using visual Studio 6.0.
Thanks,
Saleem
|
|
|
|
|
what about allocating the array with a valid size ?
|
|
|
|
|
The issue here is i do not know the size of the array.
It has to be dynamic.
|
|
|
|
|
Md Saleem Navalur wrote: char *buffer = new char[];
Based on your example, you'd need, at most, 41 bytes. I wouldn't bother Windows' memory manager for such a minuscule amount.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|