|
Never mind, after trying several gazzillion variations I found it.
WINDOW_SKIN *ws = *(WINDOW_SKIN**)lparam;
|
|
|
|
|
The only reason that works, and not (WINDOW_SKIN*) is that you didn't pass a WINDOW_SKIN* , but a WINDOW_SKIN** - or you're incredibly lucky. Have you looked at what you pass to CreateWindow and what you receive in your WM_CREATE handler (I'm assuming it's WM_CREATE ), using the debugger?
--
Torn from tomorrow's headlines
|
|
|
|
|
I've got two HEX values: 0x4D and 0x5A
I want to combine them (not add them together), so that I have an unsigned short variable with the value 0x4D5A (= 19802).
How can I accomplish this?
To be a little bit more specific:
1. I've got a temp array (unsigned char tmp[1]; ) where each byte in a binary stream passes through.
tmp[0] = br->ReadByte();<br />
tmp[1] = br->ReadByte();
2. I've made a struct like this:
<br />
struct EXE {<br />
unsigned short signature;<br />
unsigned short bytes_in_last_block;<br />
unsigned short blocks_in_file;<br />
unsigned short num_relocs;<br />
unsigned short header_paragraphs;<br />
unsigned short min_extra_paragraphs;<br />
unsigned short max_extra_paragraphs;<br />
unsigned short ss;<br />
unsigned short sp;<br />
unsigned short checksum;<br />
unsigned short ip;<br />
unsigned short cs;<br />
unsigned short reloc_table_offset;<br />
unsigned short overlay_number;<br />
void dbgPrintToConsole()<br />
{<br />
Console::WriteLine(L"Signature - HEX : 0x{0:X}", signature);<br />
Console::WriteLine(L"Bytes in last block : {0}", bytes_in_last_block);<br />
Console::WriteLine(L"Number of blocks in file : {0}", blocks_in_file);<br />
Console::WriteLine(L"Number of Relocations : {0}", num_relocs);<br />
Console::WriteLine(L"Header Paragraphs : {0}", header_paragraphs);<br />
Console::WriteLine(L"Minimum Extra Paragraphs : {0}", min_extra_paragraphs);<br />
Console::WriteLine(L"Maximum Extra Paragraphs : {0}", max_extra_paragraphs);<br />
Console::WriteLine(L"SS register start-value : {0:X}", ss);<br />
Console::WriteLine(L"SP register start-value : {0:X}", sp);<br />
Console::WriteLine(L"Checksum (usually not used): {0:X}", checksum);<br />
Console::WriteLine(L"IP register start-value : {0:X}", ip);<br />
Console::WriteLine(L"CS register start-value : {0:X}", cs);<br />
Console::WriteLine(L"Relocation table offset : {0:X}", reloc_table_offset);<br />
Console::WriteLine(L"Overlay Number : {0}", overlay_number);<br />
}<br />
};<br />
So what I'd like to do, is to assign every two bytes into the unsigned short variables in the struct EXE.
I should probably mention that I am a VC++ newbee.
Hope this makes sense to someone?
Cheers,
TylerD75
|
|
|
|
|
Use the bitwise shift operators
short x = 0;
x = 0x5A;
x ^= 0x4D << 8;
|
|
|
|
|
Hey thanks m8!
That worked too!
I'll implement a method in struct EXE, with a switch, so your way is A LOT simpler!
Thanks again!
Cheers,
TylerD
|
|
|
|
|
no problem. It can be done in one line, but I simplified for you.
|
|
|
|
|
Never mind! I figured out how to do it with memcpy
Cheers,
TylerD75
|
|
|
|
|
Okay. I admit my deep, dark secret. I'm a Delphi programmer - with a bit of Visual Basic thrown in from various jobs. But I'm looking at a program I'd like to get running under Windows but it's a Linux application and it uses either the Qt or GTK+ libraries. The app is FBReader, an ebook reader, and the author made it open source; it is written in C++. But I don't know diddly about using Visual C++ or VC++ Express. Could someone tell me how to make the GTK+ library available to VC++ Express?
Derek Benner
|
|
|
|
|
First of all, prepare for a big learning curve. GTK is NOTHING like Delphi, so be prepared for this.
Secondly there are a few things you'll need to adjust for Win32 development in VC Express.
As you know the download is here:
http://msdn.microsoft.com/vstudio/express/visualc/download/[^]
However, you'll almost certainly need a copy of the Platform SDK (which is NOT included with the free edition, but is required for general Win32 development). That's here:
Platform SDK[^]
Finally, and this is crucial for getting the IDE to properly compile and link stuff that doesn't use .Net, you'll need to tweak some settings:
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/[^]
Once all that's done (and it's a one time thing) you can try and install the GTK stuff.
For the windows version, check out:
http://www.gimp.org/~tml/gimp/win32/downloads.html[^]
However, please be aware that there are no IDE project files in the source (at least in the files I looked at). If you want these you will have to look at the makefiles (check out the make files with the .msc extension), and create them from hand. Note that the actual source is the .bz2 version of the various files. If you are using VC Express, you can't use the pre-compiled GTK versions that Tor provides because these are built with VC6 and link to the VC6 C Runtime, and I don't think you can mix and match C Runtime version between VC6 and VC Express. So you'll almost certainly need to build all the libraries from code yourself (welcome to the world of OSS , sigh... ).
You might try visiting the GTK mailing lists, people may have links to more stuff and/or docs for VC Express.
Good luck.
Also, not to pimp my own stuff, but if you're looking for something more Delphi like, in C++, you might check out the VCF[^]. It's a C++ project I work on, and being a huge former fan of Delphi, I went out of my way to make it Delphi like in a number of different areas.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Do you think the VCF supports enough widgets for me to create a Windows 'clone' of FBReader? And is there enough code to port this reader back to Linux? Also, how large is the footprint of VCF? Eventually, we want to create an embedded application that runs under uCLinux on a PXA270 or ARM7/9 board, if necessary with Nano-X to handle the low-level display driver (based around an e-ink 6" display). Given the nature of the project and the need to support USB ports, SD card slot, Nano-X and display of ebooks, would VCF fit within a 32MB/64MB embedded Linux system - it's a given that uCLinux on this system is less than 4MB and Nano-X is about 1.5MB.
Derek
|
|
|
|
|
hi, i am working on a tool (c++ mfc) that needs to copy a folder, then delete a folder.
This is terms of copy the entire folder, then delete.
Example, C:\CopyMe to C:\CopyMeHere, then delete C:\CopyMe .
is there any simple functions for that?
thanks,
Fred
|
|
|
|
|
|
thanks, will give it a try.
Fred
|
|
|
|
|
...and also see MoveFile(...)
|
|
|
|
|
Hello,
I'm using Visual C++ 2003.
I have a problem in my code at line 36,you can see the code here(I give you all the code of the file because I think that all the things are important):Code[^]
T1 is an Tic_Tac_Toe object (the class is defined from line 5-14.
pointersToNodes is a pointers array to Tic_Tac_Toe objects.
and buildNewTree is a function which returns adress of a Tic_Tac_Toe object(line 78).
at line 36 it writes me the following error:
<br />
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'Tic_Tac_Toe *' (or there is no acceptable conversion)<br />
Thats it.
Can you please tell me please why the error occurs and how to solve/fix it?
Thank you all!
SnaidiS(Semion)
|
|
|
|
|
Your declaration of the array is the problem.
Tic_Tac_Toe *PointersToNodes;
...
PointersToNodes=new Tic_Tac_Toe[9];
It is not an array of pointers, but an array of objects. For each Tic_Tac_Toe, you are calling the constructor.
try this
Tic_Tac_Toe **PointersToNodes;
...
PointersToNodes=new Tic_Tac_Toe* [9];
|
|
|
|
|
Oh my... Thank you! alot
SnaidiS(Semion)
|
|
|
|
|
You are very much welcome. It is nice to here a thankyou around here for a change ;0)
|
|
|
|
|
The left side of your assignment statement expects a value of type Tic_Tac_Toe , while your member function buildNewTree returns a pointer to a value of type Tic_Tac_Toe .
Software Zen: delete this;
|
|
|
|
|
ah Ok I got it thank you!
SnaidiS(Semion)
|
|
|
|
|
Do you by any chance take the same C++ class as SwatiPathania? (see post just beneath yours)
--
Torn from tomorrow's headlines
|
|
|
|
|
|
How can I make tic-tac-toe in C++? Plz give me some idea about it.....
|
|
|
|
|
no way... ask your class mate how to ask a question on a forum...
|
|
|
|
|
You can see the message just above yours it has a link to a code. try to read-I know that the code is not the best, but try to understand something
SnaidiS(Semion)
|
|
|
|