|
I suppose, because the MSDN DOCUMENTATION has this to say...
The initial contents of the returned memory block are undefined – there is no guarantee that the block has been initialized.
So, if you want the memoryto be all ZEROed out, you must do it yourelf, thusly:
pDibImage = (LPBITMAPINFO)CoTaskMemAlloc(400);
if( pDibImage ){
ZeroMemory(pDibImage, 400);
}
You just randomly drew some 'zeroes' when you allocated the larger block.
The minimum size is 0:
If cb is zero, CoTaskMemAlloc allocates a zero-length item and returns a valid pointer to that item. If there is insufficient memory available, CoTaskMemAlloc returns NULL.
Also...
Note Applications should always check the return value from this method, even when requesting small amounts of memory, because there is no guarantee the memory will be allocated.
|
|
|
|
|
I'm attempting to write an MFC based program that uses Arabic fonts for an Arabic class I'm taking. I'm using WinXP and have the fonts installed (i.e. I can type in Arabic in MS word), but I can't seem to associate one of those fonts with a CFont object. Well I can, but it seems that text still comes out in English. I set the justification mode from right to left and specified the enumerated type ARABIC_CHARSET when initializing the CFont. Here is a sample of the display callback in my code where I'm simply just outputting the string "hahah". It shoudl come out in
Arabic (the letters "sheen" and "alif"). Any ideas? Do I need to link to some DLL? Does some sort of preprocessor definition have to be declared? Oh and I'm using visual c++ 6.0.
void CFACKDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CPaintDC dc(this);
dc.SetTextColor(RGB(0,0,0));
dc.SetTextAlign(TA_RTLREADING);
fntArab.CreateFont(rcClient.Height()/20, 0, 0, 0,
FW_DONTCARE, FALSE, FALSE, 0, ARABIC_CHARSET,
OUT_TT_PRECIS, CLIP_LH_ANGLES,
DEFAULT_QUALITY, FF_DONTCARE, "arabic transparent bold" );
dc.SelectObject(&fntArab);
dc.TextOut(30,90, (CString)"hahah");
CDialog::OnPaint();
}
}
M.A. Shah
Computer Science Student - Penn State University
|
|
|
|
|
I thought I might have to do something like that, but I was trying to avoid it . Thanks for your help.
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
Is there any algorithm who find a double character in a string as for example (two spacebars,two semicolons )and delete one of them?Please tell me where can I find this algorithm...Thank you
|
|
|
|
|
Have you looked at CString::Replace() ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hi,
I want to add Custom Explorer Bar to Internet Explorer using C++.Can any body tell me how am I going to do that?
Thanks in advance..
|
|
|
|
|
pubududilena wrote:
I want to add Custom Explorer Bar to Internet Explorer using C++.Can any body tell me how am I going to do that?
Please Look at MFC/C++-->InTernet Section, you will found tons of example implementing that
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
When i import both libraries in Pocket PC project i get some redefinition errors:
<br />
error C2011: '_Collection' : 'struct' type redefinition<br />
error C2011: 'DataTypeEnum' : 'enum' type redefinition<br />
error C2011: 'Properties' : 'struct' type redefinition<br />
error C2011: 'Property' : 'struct' type redefinition<br />
how can be used both of them and avoid conflicts?
were rgrtgrtvrtrt rtrtb brt tyuhjghj hbhbnh hnjm 1234567?
|
|
|
|
|
Why do you need to import both libraries?
Surely adoxce31.dll extends adoce31.dll and therefore you do not need to import adoce31.dll!?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
I had the same issue, but with the PC implementation.
You will need to import the ADOX structures first, then import the ADO object, but with a redefinition.
#import "C:\Program Files\Common Files\system\ado\msadox.dll"
#import "C:\Program Files\Common Files\System\ado\msado15.dll" rename ("EOF","ADOEOF")
You could probably use the same method for your Pocket PC objects.
I Dream of Absolute Zero
|
|
|
|
|
Hi,
I have an MDI application which has a Splitter Window. The left-hand side is a TreeView and the right-hand side is a CFormView. Initially the CFormView is associated with an empty dialog, say IDD_DIALOG1. Now during runtime I have created an array of Dialog Templates in memory and added controls to them. All dynamic. Now once the user selects some option under the TreeView Control, I need to display the newly created dialog templates on the right hand side. How do I do this? I have been able to destory the exisiting window of the formView but How do i associate it with this new template and display it???
|
|
|
|
|
hi there .....;)
how do i put a bmp that is present a particular location in the hardisk into an exe when building the exe file??
|
|
|
|
|
Include it as a resource.
-------------------------
Have a great day ahead!
Regards,
Sohail Kadiwala
(My COM Blog - http://lovecom.blogspot.com)
modified 21-Apr-21 21:01pm.
|
|
|
|
|
|
Yeah i Elobarate on behalf Of Mr Sohail.
Follow these Steps
1. Insert| Resource or ctrl+r to open Resource Dialog
2.Press Import to import that bmp to your Project.
i think you are familiar with rest
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
no......thatz something that i had already tried out!!!!!
u c the bitmap happenz to be 24 bit type.....so it does not get loaded(even if it does it gets converted to 256color(16 bit).....
right now i load the image seperately.....tahtz the only way i am able to get it as 24 bit
any ideas??
|
|
|
|
|
Do as suggested but instead of having "Auto" selected when importing change that to "Custom".
You can now specify a custom name like "bmp24" for inclusion. This will treat the bitmap as binary and will not convert it.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
it workz.....
thanx a lot.....
|
|
|
|
|
Thats just Visual Studio's rubbish bitmap editor. Create a Bitmap resource, close the resource editor, and overwrite the file that corresponds to your resource with your new one. It will work fine then. I do this in my current project.
using System.Beer;
|
|
|
|
|
it workz.....
thanx a lot.....
|
|
|
|
|
Already people have explained you about it now before I could write anything
Look the Visual Studio Resource Editor is not able to display 24 bit BMP's But you can add them and use them. But while developing you wont be able to view or edit them in Visual Studio Resource Editor.
-------------------------
Have a great day ahead!
Regards,
Sohail Kadiwala
(My COM Blog - http://lovecom.blogspot.com)
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hy folks,
i'm a big greenhorn, so don't laugh: When i compile my cpp-Project everything's fine. But if i start it, the error
---------------------------------------------
Microsoft Visual C++ Debug library
Program: ..\test.exe
File:filecore.cpp
line:258
For information on how your program can cause an assertion failure, see the visual c++ doc on asserts.
---------------------------------------------
What did i wrong?? Thanks for your help.
T.
|
|
|
|
|
I think your File Handle is NULL. Let me know if you are doing any file operation in your application. If yes, then verify the Handle validity.
-------------------------
Have a great day ahead!
Regards,
Sohail Kadiwala
(My COM Blog - http://lovecom.blogspot.com)
modified 21-Apr-21 21:01pm.
|
|
|
|
|
SamuelTee wrote:
i'm a big greenhorn
SamuelTee wrote:
Microsoft Visual C++ Debug library
Program: ..\test.exe
File:filecore.cpp
line:258
For information on how your program can cause an assertion failure, see the visual c++ doc on asserts.
I like to see you test.cpp,tell me it is Console application or any MFC based application.
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
SamuelTee wrote:
What did i wrong??
You attempted to use CFile::Seek() with an invalid file handle.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|