|
What kind of runtime problems are you having?
Are you constructing and adding pages to the sheet properly before
calling Create() or DoModal()?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm getting
"Unhandled exception at 0x0051d2dc in PropSheetEg.exe: 0xC0000005: Access violation reading location 0xcccccd34."
>> Are you constructing and adding pages to the sheet properly before
>> calling Create() or DoModal()?
Oh, it probably is something silly like that. I need to investigate more.
Thanks for the pointers.
|
|
|
|
|
|
You will find a WTL sample here [^].
cheers,
AR
|
|
|
|
|
I'm building a MFC document based application and, after the Precreate window I receive the message:
Failed to create empty document
Why?
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
RomTibi wrote: Why?
Have you messed with (i.e., deleted, renamed) any of your project's menus?
Have you looked in any of MFC's DOC*.CPP files to see what condition causes the AFX_IDP_FAILED_TO_CREATE_DOC message to be displayed?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I don't know
No
I'll see and replay if necessary?
Thanks
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Hi all,
I wanna know what should i type as code to run my prog with a specific dimensions for ma FormView let's say dimensions as X= 120 and Y= 100. ??
Thank ya.
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
CClientDC dc;
dc.SetMapMode(MM_ANISOTROPIC);
CRect rt;
GetClientRect(&rt);
SetWindowExt(120,100);
SetViewportExt(rt.width,rt.height);
|
|
|
|
|
hi,
Sorry it doesn't work here teh errors
<br />
void CForthForm::OnInitialUpdate() <br />
{<br />
CFormView::OnInitialUpdate();<br />
CClientDC dc;<br />
dc.SetMapMode(MM_ANISOTROPIC);<br />
CRect rt;<br />
GetClientRect(&rt);<br />
SetWindowExt(1200,134);<br />
SetViewportExt(rt.width,rt.heigh);<br />
<br />
:\Works\C 6\AutoParall\ForthForm.cpp(69) : error C2512: 'CClientDC' : no appropriate default constructor available<br />
D:\Works\C 6\AutoParall\ForthForm.cpp(73) : error C2065: 'SetWindowExt' : undeclared identifier<br />
D:\Works\C 6\AutoParall\ForthForm.cpp(74) : error C2065: 'SetViewportExt' : undeclared identifier<br />
D:\Works\C 6\AutoParall\ForthForm.cpp(74) : error C2039: 'width' : is not a member of 'CRect'<br />
c:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(225) : see declaration of 'CRect'<br />
D:\Works\C 6\AutoParall\ForthForm.cpp(74) : error C2039: 'heigh' : is not a member of 'CRect'<br />
c:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(225) : see declaration of 'CRect'<br />
Error executing cl.exe.<br />
Creating browse info file...<br />
PS: I m using the CFormView Class.
othe thing, on which function membe should i modify the code. OnInitialUpdate() or no ??
-- modified at 4:47 Saturday 1st December, 2007
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
You may just do:
void CForthForm::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
SetWindowPos(NULL, 0,0,120,100, SWP_NOMOVE | SWP_NOZORDER);
}
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.
|
|
|
|
|
sorry doesn't work too. may be i shoul change the 'NULL' to a specific handler var
OK here the prob with images:
default form is here --> http://img132.imageshack.us/img132/681/sanstitre1rh1.th.png
the form that i wanna have is here ---> http://img137.imageshack.us/img137/2641/sanstitre2xn6.th.png
So what should i write.
I m using CFormView class not CDialog. So whazuuup . I m going kill my self if i dont do that .
-- modified at 7:00 Saturday 1st December, 2007
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
Hi,
A piece of code in my application works great when i step thru it while debugging it, but does not work when i execute the application on VC++ 6.0.
Pls note that the app is built in the debug mode (obvious ainnit!).
Any help why it could be happening?!
Cheers!
Adnan
------------------------------------------
Vision is the ability to see the invisible
|
|
|
|
|
|
Thanks, it was a helpful article indeed. But having come across the debug Vs release problems before, this one baffles me a little, cuz both the versions are in debug mode!
Its like the results differ when i step thru the method, and when i directly execute the method. The latter being a correct result.
------------------------------------
Vision is the ability to see the invisible
|
|
|
|
|
Adding/repeating the article linked:
Race condition is the most likely, if your code includes a chance for that.
Second-highest chance goes to uninitialized variables or using uninitialized pointers, the change caused by different memory initializations.
Be more specific: what does "does not work" mean?
|
|
|
|
|
peterchen wrote: Race condition is the most likely, if your code includes a chance for that
No chance for a Race condition.
As for the precise problem, well the results differ when I step thru the method and when i directly execute the method.
Correct result being LB_SETCURSEL working with SendDlgItemMessage().
the application is built in the debug mode, so no question of a debug vs release problem.
Uninitialized variables went thru my lil mind too, but why wud it not fail when i "Ctrl+F5" the application, and work when i just "F5" the app??
------------------------------------
Vision is the ability to see the invisible
|
|
|
|
|
You are working at different memory locations depending on running under the debugger or as standalone (even ctrl+F5 vs. double-clicking the exe can show differences...). Normally, in debug builds, memory locations are initilized to the same value, but there are loopholes.
Did you check the return value of SendDlgItemMessage?
Also, there are some patterns to avoid or use when sending messages, especially when focus involved, e.g. changing focus during a focus change message never works correctly.
When running under the debugger step by step, your application will get (and handle) additional killfocus and setfocus messages. Which might at least explain the difference.
|
|
|
|
|
Ah VC6...
The compiler is buggy, so if you've tweaked any of the compiler knobs first untweak them. The defaults are the safest & most reliable.
Next, do a full rebuild regardless. Out of sync object files create a variety of mysterious problems.
Assuming a clean build, you might be getting an exception that's masked by the breakpoint trap. I'd probably brute force debug this by just adding TRACE statements to narrow down where the error occurs.
-- Ian
|
|
|
|
|
Hi,
I have an application that has a ListCtrl. After creating a new dialog over the ListCtrl, and if I close the dialog by Cancel or OK button, there is a shadow that has the Windows dialog classic color covering some part of the ListCtrl. For columns on the ListCtrl, I can just put the cursor over it and then the text is shown automatically. For Items, I have to Left click them to get them displayed.
Also, if I minimize the application and restore it again, the whole part of the ListCtrl is covered by the windows classic color.
My system is Windows XP in Classic theme.
Thanks for any idea or help about this.
Toe the line
Thread the needle
Think outside of the box
|
|
|
|
|
It sounds like you've sent WM_SETREDRAW to your listctrl at some point. (probably using an MFC function), and didn't clear it.
Iain.
|
|
|
|
|
hello , i've tryed to capture snapshots on yahoo webcam with bitblt to make a yahoo webcam recorder, i managed to do it but with some problems. on my webcam it works perfectly the image captured is clear but if i try to snapshot another webcam window(some work some don't) the image is scrambled. i will post the entire source code it's not too long and a sample snapshot to see the problem.
http://rapidshare.com/files/73346892/frame_2.bmp.html
<br />
HWND frame,mainwin,last=NULL;<br />
<br />
<br />
bool writebmpfile(int bitmap_dx,int bitmap_dy,int bytes, BYTE *memory,BITMAPFILEHEADER fileHeader,BITMAPINFOHEADER infoHeader,int frame);<br />
<br />
<br />
typedef struct cadre<br />
{<br />
char cadru[200];<br />
}cadre;<br />
<br />
<br />
cadre cadre[10000];<br />
<br />
<br />
<br />
BOOL CALLBACK findchildweb(HWND hwnd,LPARAM lParam)<br />
{<br />
char clasa[100]={0};<br />
char text[150]={0};<br />
<br />
<br />
GetClassName(hwnd,clasa,100);<br />
<br />
if(!strcmp(clasa,"ATL:0B39D378")|| !strcmp(clasa,"#32770"))<br />
{ <br />
frame=hwnd;<br />
<br />
<br />
}<br />
<br />
GetWindowText(hwnd,text,150);<br />
<br />
if(strstr(text,"Last")!=NULL || strstr(text,"Broadcast")!=NULL)<br />
{<br />
last=hwnd;<br />
<br />
}<br />
<br />
<br />
<br />
<br />
if(last!=NULL && frame!=NULL)<br />
return false;<br />
else<br />
return true;<br />
<br />
}<br />
<br />
<br />
<br />
BOOL CALLBACK findwebwnd(HWND hwnd,LPARAM lParam)<br />
{<br />
char clasa[100]={0};<br />
<br />
GetClassName(hwnd,clasa,100);<br />
<br />
if(!strcmp(clasa,"WebcamClass"))<br />
{<br />
mainwin=hwnd;<br />
EnumChildWindows(hwnd,findchildweb,0);<br />
return false;<br />
<br />
}<br />
<br />
<br />
<br />
<br />
<br />
return true;<br />
}<br />
<br />
<br />
<br />
<br />
bool findandcapture()<br />
{<br />
frame=NULL;<br />
HDC devcnt=NULL,devc=NULL,cmpdc=NULL;<br />
RECT dim={0};<br />
HBITMAP bmp=NULL;<br />
BYTE *memory=0;<br />
<br />
BITMAPFILEHEADER fileHeader;<br />
BITMAPINFOHEADER infoHeader;<br />
BITMAPINFO info;<br />
int numframe=-1;<br />
<br />
char cur[150]={0},prev[150]={0};<br />
<br />
<br />
<br />
<br />
<br />
<br />
EnumWindows(findwebwnd,0);<br />
<br />
<br />
<br />
<br />
if(frame!=NULL)<br />
devcnt=GetWindowDC(frame);<br />
else<br />
return false;<br />
<br />
GetWindowRect(frame,&dim);<br />
<br />
int bitmap_dx = dim.right - dim.left;<br />
int bitmap_dy = dim.bottom - dim.top;<br />
<br />
fileHeader.bfType = 0x4d42;<br />
fileHeader.bfSize = 0;<br />
fileHeader.bfReserved1 = 0;<br />
fileHeader.bfReserved2 = 0;<br />
fileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);<br />
<br />
infoHeader.biSize = sizeof(infoHeader);<br />
infoHeader.biWidth = bitmap_dx;<br />
infoHeader.biHeight = bitmap_dy;<br />
infoHeader.biPlanes = 1;<br />
infoHeader.biBitCount = 24;<br />
infoHeader.biCompression = BI_RGB;<br />
infoHeader.biSizeImage = 0;<br />
infoHeader.biXPelsPerMeter = 0;<br />
infoHeader.biYPelsPerMeter = 0;<br />
infoHeader.biClrUsed = 0;<br />
infoHeader.biClrImportant = 0;<br />
info.bmiHeader = infoHeader;<br />
<br />
<br />
<br />
cmpdc=CreateCompatibleDC(devcnt);<br />
<br />
bmp=CreateDIBSection(devcnt, &info, DIB_RGB_COLORS, (void**)&memory, 0, 0);<br />
DWORD eror=GetLastError();<br />
SelectObject(cmpdc,bmp);<br />
<br />
<br />
<br />
while(1)<br />
{<br />
<br />
<br />
if(strcmp(cur,prev) || strstr(prev,"Broad")!=NULL)<br />
{<br />
numframe++;<br />
<br />
GetWindowText(last,cur,150);<br />
<br />
BitBlt(cmpdc, 0, 0, bitmap_dx, bitmap_dy, devcnt, 0, 0, SRCCOPY);<br />
<br />
int bytes = (((24*bitmap_dx + 31) & (~31))/8)*bitmap_dy;<br />
<br />
<br />
<br />
writebmpfile(bitmap_dx,bitmap_dy, bytes, memory,fileHeader,infoHeader,numframe);<br />
<br />
<br />
DeleteObject(bmp);<br />
<br />
if(UpdateWindow(mainwin)==false)<br />
break;<br />
<br />
if(strstr(prev,"Broad")!=NULL)<br />
Sleep(500);<br />
<br />
}<br />
else<br />
Sleep(1);<br />
<br />
<br />
GetWindowText(last,prev,150);<br />
<br />
<br />
<br />
<br />
Sleep(1);<br />
}<br />
<br />
<br />
<br />
<br />
DeleteDC(cmpdc);<br />
ReleaseDC(frame, devcnt);<br />
<br />
<br />
<br />
<br />
<br />
return true;<br />
}<br />
<br />
<br />
bool writebmpfile(int bitmap_dx,int bitmap_dy,int bytes, BYTE *memory,BITMAPFILEHEADER fileHeader,BITMAPINFOHEADER infoHeader,int frame)<br />
{<br />
<br />
<br />
<br />
<br />
FILE *fisier;<br />
<br />
<br />
sprintf(cadre[frame].cadru,"%s_%d.%s","frame",frame,"bmp");<br />
<br />
<br />
<br />
fisier=fopen(cadre[frame].cadru,"w+");<br />
<br />
<br />
<br />
fwrite((char*)&fileHeader,1,sizeof(fileHeader),fisier);<br />
<br />
fwrite((char*)&infoHeader,1,sizeof(infoHeader),fisier);<br />
<br />
fwrite(memory,1,bytes,fisier);<br />
<br />
<br />
<br />
fclose (fisier);<br />
<br />
<br />
<br />
<br />
return true;<br />
}<br />
<br />
<br />
<br />
|
|
|
|
|
What do you mean by "scrambled"?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
the picture has interference like an old tv or a cracked LCD display
|
|
|
|
|
I don't have an old TV or a cracked LCD display to compare to.
Can you post an example image somewhere?
If it works on some windows and not others, then I imagine it's
a problem with the way the video is being rendered (DirectX,
for example), you're scraping the screen out of sync with the video
refresh, or you're getting frames in between key frames.
Just guesses...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|