|
According to documentation, the first word of the buffer should contain its size.
I would suggest using of the second variant of GetLine function, with three arguments:
wordnum = m_dlg->m_cedit.GetLine(0, buffer, 10);
I hope this helps. Note that not all of functions can be used in different threads.
|
|
|
|
|
|
Hi,
I have an activex developed with MFC that now needs to load a managed
assembly and
I want to publish the activex in a cab with all the dlls.
The only way I set it to work was adding a /manifestdependency in the
activex for the assembly and copying it to the IE directory.
Nevertheless, the assembly must also be in the activex directory for
registration. My purpose is to only have this copy of the assembly in
the activex directory.
I tried to change the lpAssemblyDirectory using Activation Context with
no luck.
I also tried to load the assembly with the full path, which gave no
error, but when the managed objects are created it is performed another
load of the assembly in the IE directory (I saw the binding logs).
I also tried to sign the assembly but the activex registration fails
after including the publicKeyToken in manifestdependency.
Any suggestion?
Thanks a lot...
Sandra
|
|
|
|
|
Hi All,
I derived a class from CButton and I'm creating pointers with style BS_OWNERDRAW. This works fine if i give style as WS_CHILD|WS_VISIBLE|BS_OWNERDRAW.
But now i want to custom draw my Radio Button, i giving style as WS_CHILD|WS_VISIBLE|BS_OWNERDRAW|BS_AUTORADIOBUTTON.
But my DrawItem method is not getting called...if remove the BS_AUTORADIOBUTTON style my DrawItem method is called..
Why is this happing?... How can i custom draw my button as radio button..
Thanx
Do your Duty and Don't expect the Result
|
|
|
|
|
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
|
|
|
|