|
you can't "delete" something that you didn't create with "new".
-c
WWT2D?
|
|
|
|
|
If you mean clearing out the array do this: r1[0] = '\0'; (All clear!)
|
|
|
|
|
georgiek50 wrote:
If you mean clearing out the array do this: r1[0] = '\0'; (All clear!)
This assumes you are using r1 as a character string rather than an array of bytes.
If you want to "clear out" an array, try:
memset(r1,0,1000);
|
|
|
|
|
Even though it is an array of byte wouldn't \0 take care of everything? which brings me to ask another question. If I declared an array of bytes say array[100] but then only needed to fill the first fifty. Do I need a NULL character like in a string? If yes how would I set it. If no, why not?
|
|
|
|
|
georgiek50 wrote:
Even though it is an array of byte wouldn't \0 take care of everything? which brings me to ask another question. If I declared an array of bytes say array[100] but then only needed to fill the first fifty. Do I need a NULL character like in a string? If yes how would I set it. If no, why not?
I didn't make myself clear. If you are using the array of bytes as a null-terminated cstring:
strcpy(r1,"This is a string");
Then terminating at the "zero'th" position will clear out the string. For example, if you said:
strcpy(r1,"0123456789 This is a string");
r1[15] = 0;
printf("%s\n", r1);
The output would be "0123456789 This "
If you then dumped the first 20 bytes of r1:
for(int i = 0; i < 20; i++)
{
printf("0x%02X ", r1[i]);
}
You would get something like:
0x30 0x31 0x32 ... 0x39 0x20 0x54 0x68 0x69 0x73 0x00 0x69 0x73 ...
That's the convention for null-terminated cstrings (not to be confused with CString); a 0 terminates the string. If it is just an array of bytes, then 0 is just another value.
|
|
|
|
|
Ok, I see what you're saying now.
|
|
|
|
|
Is there an easy way to put a bitmap in the status bar?
I've been looking into it...and my solution is to derive a class from CStatusBar and then add bitmap functionality manually.
I would think there is an easier way to do this.
john
|
|
|
|
|
Crash Operator wrote:
my solution is to derive a class from CStatusBar
Yeah, and then override virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
Check out the MSDN article Q149407 (HOWTO: How to Display a Bitmap in a CStatusBar Pane)
Hope it helps!
Dylan Boycott Bush Punch GWB
|
|
|
|
|
I am using the following code to get the image drawn on a hidden window.
CBitmap bitmap;
CDC memDC;
memDC.CreateCompatibleDC(NULL);
bitmap.CreateCompatibleBitmap(&memDC, 600,400);
CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
memDC.Rectangle (100,100,300,300);
memDC.Ellipse (100,100,400,400);
memDC.BitBlt(0, 0, 600,400,NULL, 0, 0, SRCCOPY);
and then saving this image as a bitmap file.
But passing NULL in BitBlt (bcz i want to draw images in hidden window) i get the background color of my
image as black.
How to change bgcolor to white.
|
|
|
|
|
I have a list control that uses LVS_OWNERDATA and uses custom draw. When I do a SetItemCountEx to redraw the window, the list erases and repaints causing flicker. Is there any standard way to handle this flicker OR do I have to handle EraseBackgound and do some logic there to erase only the area without items. I will have to paint the background where there are no items.
All this looks like workarounds to me, and I think I am missing something very obvious.
Thomas
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
|
I want the list control header to look flat (like with the LVS_NOSORTHEADER), but I want the OnColumnClick notification. Is there a standard way to do it? Or do I have to subclass and implement drawitem?
I would prefer to have the header control drawn using the default code (I do not want to get involved in the font sizing with different dpi screens and such other details), so, if I subclass the header, can I fire the LVN_COLUMNCLICK myself?
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
I think you can trap for left mouse clicks on your list control and then do a hit test on the header control. Then you could launch your sort function within the mouse click rather than the looking for the OnColumnClick notification. Like the following:
CHeaderCtrl* header = m_ListCtrl.GetHeaderCtrl();
if (header)
{
CPoint headerPoint = point;
LV_HITTESTINFO hitTestInfo;
header->ScreenToClient(&headerPoint);
hitTestInfo.pt = headerPoint;
::SendMessage(header->m_hWnd, HDM_HITTEST, 0, (LONG)(HD_HITTESTINFO FAR*)(&hitTestInfo));
if (hitTestInfo.iItem >= 0) // User hit a header column
{
// Do sort routine here
}
}
Ron Ward
|
|
|
|
|
|
Hello,
What's the best way to coding database ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I use VS to edit scripts, but sometimes I write SQL in Notepad.
|
|
|
|
|
Sorry,
I think i've asked the question very bad, in fact i've already database (it's access 2000) ...
I wanna know what's best way to encrypt the data in the database ?
and then use of encrypted data in my program.
Regards,
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hadi Rezaee wrote:
best way to encrypt the data in the database
if i would do something like that, i would do something like this:
use the class that is explained here: http://www.codeproject.com/cpp/aes.asp[^]
Every record that is written to de database is first encrypted bij the class.
Hadi Rezaee wrote:
in fact i've already database
for this problem i would put a character at place 1 in your record that says if the record is encrypted yet, if the character is not there the program will know that the record is not encrypted. then ofcourse encrypt the data and put the character before the encrypted data.
this is the way that i would do something like that, i don't know if its the best way.
[]D [] []D []
|
|
|
|
|
How can I get the the network names and there IP adresses?
\Larsson
|
|
|
|
|
Use WNetOpenEnum to obtain the names...
then for each name use gethostbyname to resolve the IP.
Hope this helps
"No matter where you go, there your are..." - Buckaoo Banzi
<pete/>
|
|
|
|
|
Well,
I don't get it to work can you please send me some
code sample?
\Larsson
|
|
|
|
|
im making a game that is rendered by GDI+
however, standard GDI BitBlt's and even threads make the game window look very slow and i can see the refresh rate or whatever you call it when i render to the HDC
my question is... is it possible (and is there an example) of using GDI+ to render to a DirectDraw surface (ill probably use the latest DirectDraw or whatever is easier)
OR (even better)
is there a way for me to draw directly to the screen (without windows layer) like Windows Media Player and DirectX seem to do?
i know it would require some pixel-format conversions but i'm ready to work with that
any suggestions?
- Roman -
|
|
|
|
|
Ok i just got the windows media DRM SDK delivered to me from MS. I added it into my project and now i get a linker error.
error LNK2001: unresolved external symbol __ftol2
I also updated my MS Platform SDK a few dats ago (while i was trying to get a copy of the internet SDK , i didn't even want the upgrade)
I've searched and heard that __ftol2 may have something to do with managed C++ and or .NET , can anyone tell me how to get around this.
thanks.
Jared Allen.
www.chironexsoftware.com
|
|
|
|
|
Seems like the library you're trying to use is targeted at VC++ 7.0: a search on Usenet reveals that __ftol is an internal library of VC++ 7.0's C run-time library.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
_ftol is a function invoked when you do a double to long typecast. it's inserted automatically by the compiler:
; 38 :
; 39 : double t = 100.23;
mov DWORD PTR _t$[ebp], 1374389535 ; 51eb851fH
mov DWORD PTR _t$[ebp+4], 1079578296 ; 40590eb8H
; 40 : int l = t;
fld QWORD PTR _t$[ebp]
call __ftol
mov DWORD PTR _l$[ebp], eax
i'm not sure what _ftol2 is about, but i suspect it's a .Net thing. i see it when i accidentally try to mix VC6 and VC7 .obj files.
-c
Get there first with something patented, proprietary, and broken, then send lawyers after anyone who points out problems. --- Peter Gutmann
|
|
|
|