|
http://msdn2.microsoft.com/en-us/library/ms673347.aspx[^]
[quote]
BS_OWNERDRAW
Creates an owner-drawn button. The owner window receives a WM_DRAWITEM message when a visual aspect of the button has changed. Do not combine the BS_OWNERDRAW style with any other button styles.
[/quote]
|
|
|
|
|
Hi Arends,
Thanx.. actually i refered Jan'2005 MSDN.. it says..
Creates an owner-drawn button. The framework calls the DrawItem member function when a visual aspect of the button has changed. This style must be set when using the CBitmapButton class.
Now i'm facing another problem, even though i set the checked state by SetCheck(BST_CHECKED), i'm not getting the BST_CHECKED value while i'm using GetCheck()..
Any Idea...
Thanx again..
Do your Duty and Don't expect the Result
|
|
|
|
|
If you run this code do you get any change or its like your problem
<br />
CButton m_Button;<br />
myButton.Create("Test", WS_CHILD|WS_VISIBLE|BS_AUTO3STATE,<br />
CRect(0,0,100,23), this, 1);<br />
m_Button.SetCheck(BST_CHECKED);<br />
|
|
|
|
|
Hi Whitesky,
The above code will work fine..
My problem is i have to draw a custom option(Radio) button.
So i derived a class from CButton and i override the DrawItem method...
As per MSDN we cannot combine any other style with BS_OWNERDRAW.
Always i'm getting BST_UNCHECKED, so i cannot able to draw the checked radio.
in DrawItem, DRAWITEMSTRUCT::itemState has no ODS_CHECKED flag and also if i use the GetCheck() API it returns BST_UNCHECKED.
Do your Duty and Don't expect the Result
|
|
|
|
|
Maybe its not good way but its possible if you use of DrawItem you can imitation behavior of checkbox for radio button (once I tried many years ago with three buttons(checkbox)and it worked)
|
|
|
|
|
I’m adding a MFC window to an existing application. When I compile the “Create” everything is fine, but when I compile I get an acception:
ENSURE(afxOccMgr !=NULL);
Here is my code examples
CMainFrame::CMainFrame()
{…
AfxEnableControlContainer();
…
pMainFrm = this;
…
AfxOleInit();
….
}
Class Mysub : public CWnd
C3DWindow *m_p3dWnd;
Extern CMainFrame *MainFrm;
…
MySub::Load()
{…
m_ p3dWnd = new C3DWindow();
…
bRet = m_ p3dWnd ->Create("Internal_Win", 0, Rect,
pMainFrm, ID_MEM, NULL, FALSE);
…
}
Note: I’m developing on VS2005 with Shared MFC and CLR enabled.
Thanks
-- modified at 11:05 Tuesday 14th November, 2006
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
edit your post and place your code into <pre></pre> tags
|
|
|
|
|
|
Max++ wrote: What is <pre></pre> tags ?
don't you know HTML ?
when posting code, surround it like this :
<pre>
void main(void) {
::printf("Hello world !!!\n");
}
</pre>
which gives you :
void main(void) {
::printf("Hello world !!!\n");
}
|
|
|
|
|
toxcct wrote: don't you know HTML ?
This is a Visual C++ / MFC board. Not all of us know HTML there cowboy.
|
|
|
|
|
dude, restrict yourself to C/C++, you won't go far in your life then...
|
|
|
|
|
I think a good way is learning Visuall Studio .Net
|
|
|
|
|
But some titles are depend for example read and write to sql maybe its for sql forum
|
|
|
|
|
hi i want to copy bitmap file from disk to memory and then read it bits and after changing some bits then i want to save agian to the file.
i could do that reading bit by bit but that is slow method which i dont want so i want to copy whole image to memory at once.
i m using this code to read/copy image into memory,
HANDLE handle=CreateFile("D:\\tasleem.bmp",GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);<br />
if (handle == INVALID_HANDLE_VALUE)<br />
{<br />
return 0;<br />
}<br />
DWORD fileSize=GetFileSize(handle,NULL);<br />
DWORD bytesReaded,bytesWritten;<br />
<br />
unsigned char *Rbuff=new char[fileSize];<br />
ReadFile(handle,(LPVOID)Rbuff,fileSize,&bytesReaded,NULL);<br />
if (bytesReaded==0)<br />
return 0;<br />
CloseHandle(handle);
i looked at bytesreaded variable by debugging its equal to the fileSize variable but when i try to display from memory into console it does not show,any it show garbage.
when i write on another file data from Rbuffer then that is copied and iamge is copy of that hence it all works i think problem is with accessing/display values.
i m trying to show bitmapfile header and info header structure of bitmap only for verification that it works or not.here is the code
cout<<"\n Bitmap File header";<br />
cout<<"\n"<<Rbuff[i];<br />
i+=2;<br />
cout<<"\n"<<Rbuff[i];<br />
i+=4;<br />
cout<<"\n"<<Rbuff[i];<br />
i+=2;<br />
cout<<"\n"<<Rbuff[i];<br />
i+=2;<br />
cout<<"\n"<<Rbuff[i];<br />
i+=4;<br />
cout<<"\n"<<Rbuff[i];
-- modified at 11:21 Tuesday 14th November, 2006
Tasleem Arif
|
|
|
|
|
tasleem143 wrote: DWORD file=GetFileSize(handle,NULL);
Just curious, but do you supopose that someone three weeks from now will be able to discern that file represents the size of a file?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i had changed that it was just the test code a part of program it was not final version code with variable.i just changed that on ur demand
top fileSize ,which was not my question its still on.
Tasleem Arif
|
|
|
|
|
tasleem143 wrote: unsigned char *Rbuff=new char[fileSize];
Why are you allocating char s for an unsigned char variable?
tasleem143 wrote: cout<<"\n Bitmap File header";
cout<<"\n"<<rbuff[i];< blockquote="">
Use endl instead of \n . Otherwise, cout 's caching will mess you up.
Is cout producing anything? If it looks like a memory address, you might need to cast it to a char ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
tasleem143 wrote:
unsigned char *Rbuff=new char[fileSize];
sorry for this mistake,it was char* then i forget to replaced other side.
yes cout displays but these are fake char like BM p ? ( etc.
Tasleem Arif
|
|
|
|
|
tasleem143 wrote: fake char like BM p ?
Last time I checked, B, M, p, and ? were all real characters. What exactly are you referring to?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i want to see the exact fields values present in the bitmapfileheader and bitmapfileinfo,when i read bit by bit from hard disk using fread etc then those values are not matched with the current i mean read through memory values i want that both should match so that i m confirmed that these r valid values from memory.
Tasleem Arif
|
|
|
|
|
tasleem143 wrote: i want to see the exact fields values present in the bitmapfileheader and bitmapfileinfo,when i read bit by bit from hard disk using fread...
So why aren't you doing something like:
CFile fileBitmap;
BITMAPFILEHEADER rBitmapFileHeader;
BITMAPINFOHEADER rBitmapInfoHeader;
fileBitmap.Open(strFilename, CFile::modeRead);
fileBitmap.Read(&rBitmapFileHeader, sizeof(BITMAPFILEHEADER));
fileBitmap.Read(&rBitmapInfoHeader, sizeof(BITMAPINFOHEADER));
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
thanks for replay!
i had done that b4 and it works,The purpose of reading from memory n displaying was that i want to confirm that bitmaps is correctaly copied in memory, and purpose of displaying through cout<< was that i m varified that both outputs are same, and if i perform the operations like changing its bits from memory then get the correct bits to change.
what i m doing i had read the file from disk through 2 methods
1.as u mentioned above and it works fine reading byte by byte or structure but this method is slow as i had to read the whole image byte by byte and it will take lot of time.
2.Through second method i m reading the whole image once not like byte by byte as method 1. i.e
file.read(buffer,filesize);
what i m doing is displaying the data using cout and confirming that both workd fine or not.
hope now u understood the situation.
Tasleem Arif
|
|
|
|
|
Is anyone kindly to tell me how can i save and resotre the child frames that last opened in a MDI program?
In the Main Frame,left side is a Tree Pane,when we selected a tree item and double click,it will create a corresponding child frame,The Child Frames are created dynamicly. When i close the program ,i need to save the status of the opened frame and open them the next time i start the program.
Is anybody can give me an example?
|
|
|
|
|
If I understood you want to save current status of your program you can save parameters to a file or on the registry and when you want to run your program first you read parameters and set your program to it.
|
|
|
|
|
How can A maximaze a dialog at runtime?
|
|
|
|