|
Note that you have to delete it later to avoid memory leaks!
Were you talking about the 'MyItem'? I don't c why it should be deleted
|
|
|
|
|
// See code for an example:
void FillHeader()
{
CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
HDITEM MyItem;
pHeader->GetItem(nCol, &MyItem);
MyItem.mask = HDI_LPARAM; // was: HDI_TEXT;
myItem.lParam = (LPARAM) strdup(szYourString); // make a copy of your string on the heap!
pHeader->SetItem(nCol, &MyItem);
}
void UseLPARAM()
{
CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
HDITEM MyItem;
MyItem.mask = HDI_LPARAM; // was: HDI_TEXT;
pHeader->GetItem(nCol, &MyItem);
CString temp((LPSTR)MyItem.lParam);
}
Here a copy is made of the text you like to attach to the lParam member if HDITEM (strdup).
It returns a pointer to a copy of your string. This pointer is stored in the lParam.
Because a copy is made, you need to delete the string with free when the header control
is not used anymore.
Hope this helps....
|
|
|
|
|
The mask member indicates which other items in the HDITEM struct are being used, so you need to set it to HDI_LPARAM and init the struct to all 0's:
HDITEM MyItem = {0};
MyItem.mask HDI_LPARAM;
...
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Hello.
I need a little help.
What is it about...
I have a project in which im using ADO. So i import an ado dll like that :
#import "c:\Program Files\Common Files\system\ado\msado15.dll" no_namespace rename("EOF", "adoEOF")
its ÎÊ
But i need to use and AdoX
so in one help ( in MSDN ) i saw that code and i used in py project:
#import "c:\Program Files\Common Files\system\ado\msado15.dll"
#import "c:\Program Files\Common Files\system\ado\msadox.dll" no_namespace
Super, but it does not work:
--------------------Configuration: s - Win32 Debug--------------------
Compiling...
StdAfx.cpp
\my_source\s\debug\msado15.tlh(409) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
\my_source\s\debug\msado15.tlh(1317) : error C2629: unexpected 'short ('
\my_source\s\debug\msado15.tlh(1317) : error C2238: unexpected token(s) preceding ';'
\my_source\s\debug\msadox.tlh(1201) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
Error executing cl.exe.
s.exe - 2 error(s), 2 warning(s)
////////////////////////////////////
when i click on the error it goes to the source file on this line: VARIANT_BOOL EOF;
I tried various ways, to change places of the no_namespace rename("EOF", "adoEOF") è no_namespace
but there is no any result, just gives me other errors.
So if anyone knows how it would work ill be glad to tell me.
Thank you in advance.
|
|
|
|
|
try this that I use on all of my ado projects (declared in stdafx.h):
<br />
#pragma warning(push)<br />
#pragma warning(disable:4146 4192)<br />
<br />
#import "C:\Program Files\Common Files\system\ado\msadox.dll"<br />
#import "C:\Program Files\Common Files\System\ado\msado15.dll" rename ("EOF","ADOEOF")
#import "C:\Program Files\Common Files\system\ado\msjro.dll" rename_namespace("JRODB")
<br />
using namespace ADODB;<br />
#pragma warning(pop)<br />
I have included the JRO libraries, but you can comment those out if not being used.
Richard.
|
|
|
|
|
If you look at your #import s, then you can see that you don't rename EOF in msado15.dll like you do with the EOF in msadox.dll.
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Decision is:
<br />
#pragma warning (disable: 4146)<br />
#import "d:\Program Files\Common Files\system\ado\msadox.dll" rename_namespace("ADO_X") rename("EOF", "adoEOF")<br />
#import "d:\Program Files\Common Files\system\ado\msado15.dll" no_namespace rename("EOF", "adoEOF")<br />
so where you need to use an adoX you can type: using namespace ADO_X.
)
thanks for help
|
|
|
|
|
Hi, I am sorting a list of string using STL list's sort() function. It is performing well only if list contains less than 32768 records. But what if records exceed more than this ?
Can anybody help me. ????
Thanxs a lot.
C.R.Naik
|
|
|
|
|
I assume you are using MSVC6 and haven't applied the bugfixes.
|
|
|
|
|
Which open source diff source code is the best to use?
I tried a few and i'm having trouble, some just won't compile under VC++6
(sorry i didn't ask this in last nights question - it slipped my mind).
Thanks very much.
Colin
|
|
|
|
|
There are several diff articles here on CP you can look at. LCS is probably the best approach.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
|
I think that's a bit advanced for what i need.
I just need source that will output a diff summary when passed two filenames.
any simpler ideas?
thanks!
ps. thanks everyone that has helped me here - I'm getting quite a lot better thanks to your kick starts - cheers
|
|
|
|
|
Hi all!
I need to split my main screen into several panes using the CSplitterWnd. The problem is that I want the different splitter have a fixed size (the user should not resize them).
How can I do it? Is there a specific style for disabling resizing ??
Thanks
|
|
|
|
|
Off the top of my head.
At the very least a frame or pane needs to recieve a WM_SIZE message, use the Visual C++ debugger to find out for sure. If you override these methods/functions/messages you can stop the size of the any window from changing. Do not forget to take into account windows smaller than you expect and or weather the user wishes to minimize the application, also screen resolution may play a part (if it is to big to run in safe mode it is to big).
Trust in the code Luke. Yea right!
|
|
|
|
|
Yes it could be a solution but it's not really what I wanted. I just want the separation between the panes not to be mobile (so, when the mouse arrive on it, the cursor don't change also to a sizeable cursor).
Is it possible to do such a thing?
Thanks
|
|
|
|
|
Use the class wizard to create a CSplitterWnd derive class. Add message handlers for WM_LBUTTONDOWN, WM_MOVEMOUSE, and WM_SETCURSOR. Then do the following:
Replace the defaults:
CSplitterWnd::OnLButtonDown(nFlags,point);
CSplitterWnd::OnMouseMove(nFlags,point);
CSplitterWnd::OnSetCursor(nFlags,point);
With:
CWnd::OnLButtonDown(nFlags,point);
CWnd::OnMouseMove(nFlags,point);
CWnd::OnSetCursor(nFlags,point);
Then use your dirived class in place of CSplitterWnd.
FYI: The above imformation is in the book "The MFC Answer Book" By Eugene Kain. Search for "MFC FAQ".
Trust in the code Luke. Yea right!
|
|
|
|
|
Great !!
That's much more elegant
Thanks a lot
|
|
|
|
|
is there any way to get pixel size from HBITMAP?
(i want to center it into rectangle)
(most often it is loaded by LoadImage - maybe resource pixel size is available?)
t!
|
|
|
|
|
Use GetBitmapDimensionEx to get the dimensions of the bitmap.
|
|
|
|
|
but help speaks you must call set before (and it is not in pixels)
t!
|
|
|
|
|
First of all yes I know the answer, but if your are using Visual C++ and MFC, a simple search of the help sytem will give you the answer.
Example: (You could write this)
CSize GetSizeOfBitmap( CBitmap& MyBitmap )
{
BITMAP bmp;
MyBitmap.GetBitmap(&bmp);
return CSize(bmp.bmWidth,bmp.bmHeight);
}
------------------------------------
Trust in the code Luke. Yea right!
|
|
|
|
|
thanks
sometimes look and see is not the same
t!
|
|
|
|
|
Hello,
How about this way?
--------------------------------------
BITMAP bitmap = {0,};
GetObject(hBitmap, sizeof(BITMAP), &bitmap);
--------------------------------------
I wish this way is helpful to you.
Thanks.
|
|
|
|
|
I need to put data into array form. My data is :
0x12 0x24 0xAB
0x11 0xAA 0xBB
0xCC 0xDD 0xFF
Array[x][x] is to be created after counting the number of character on first row of the data . Then every 0x__ is store to one element example: Array[0][0] = 0x12, Array[0][1] = 0x24.
And also I need to be able to check if every 5th character is a spacing and every 1st character and 2nd character of each element is in 0x form. IF it is not 0x then a msg telling which Array[x][y] is incorrect or something like that.
I heard of using vector but I don't how I can give the specific location of the incorrect array[x][y]. But if I use array, my array size cannot be flexible as array size got to be declared with a size, where the 'size' cannot be given a value only after counting the number of characters
in the first row of data. Anyone can help?
|
|
|
|