|
Why do you want to copy a DWORD into a BYTE buffer?
Anyway, how about something like this...
(I have just written it in the browser, so there might be syntax errors...)
DWORD dw = 65535;
byte b = (byte*)malloc(sizeof(DWORD));
memcpy(b, dw, sizeof(DWORD));
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
There is also
*((DWORD *) b) = dw;
But that has some minor drawbacks on many CPUs. If b is not aligned on a DWORD, you get an alignment fault. Luckally, that isn't a problem on intel processors.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
I hope that you have seen the web browser called "NEO-PLANET". Its user interface is really interactive. I want to create such user interfaces using VC++. Please help me in this regard.
Imran Farooqui
|
|
|
|
|
|
there are one const memeber constM and one const function constFunction
#classA head file
class classA
{
const int constM ;
const int constFunction ();
}
class classA::constM;
#end of classA head file
#classA cpp file
int constFunction (){return 0;};
#end of classA cpp file
#fileB head file
#include "classA.h"
void main()
{
};
class fileB::cons
compile error:
two obj file LNK2001
Help!!Help!!Help!!
Please pardon my weak English!
|
|
|
|
|
Place you "class classA::constM" in the classA.cpp file. Having it in the H file causes it to be defined in every .CPP file that includes classA.h.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Thanks!!!
Please pardon my weak English!
|
|
|
|
|
Hi, all.
========
Under win98 file name longer than 8.3 appear with "~1" in DOS.
example:
--------
Win98, the file looks like this:
filename longer than 8 chars.dat
DOS, the file looks like this:
filena~1.dat
Does anyone know where the filename is stored, and how does it work?
thanks!!
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
The long file name occupies multiple, linked entries in FAT directory. These entries are marked with attribute combination which was never used in any version of DOS. When you save file with a long fn to floppy and read this on a machine running DOS (do you still have one?), these directory entries are ignored by operating system.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
so...
if I understood right:
long file names and short file names saved on the HD the same way but the Operating System reads it differently
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
i am working in tcp/IP communication.
i am using some Third Party API's for connecting through TCP/IP.
the API taking Lot of time to check the connectivity.
is there any API in MSDN which can ensur connectivity for specified IP address. Kindly Reply ASAP.
Looking forward for early reasponse
Suleman
|
|
|
|
|
Is it always taking a long time, or is it just when the program cannot connect to the server that it takes a long time?
If it only is when it cannot connect there is really not much to do about it.
If the program try to connect to a server that does not exist, it sends, (windows socket standard), a SYN packet to the ip-address, and wait for some time for an answer (a SYNACK packet), if it don't get the answer it tries 2 more times.
It takes some time, about 30 seconds, I would say...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Can someone give me a little example of code how to use the VK_UP key in MFC.
I want that if I press the "up" key a messagebox should appear...
|
|
|
|
|
You want to capture WM_KEYDOWN, WM_KEYUP or WM_CHAR, then it's a case of doing a switch on the nChar variable passed in:
switch (nChar)
{
case VK_UP:
AfxMEssageBox("You pressed up");
break;
I generally go for WM_KEYDOWN.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
But Why it doesn't work with VK_RIGHT and VK_DOWN?
|
|
|
|
|
Are you subclassing a dialog control?
If so, you will need to handle the WM_GETDLGCODE message to inform the dialog that you want the arrow keys.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
I create a default empty MFC "dialog based" and OnKeyDown is the only function I have... and I have deleted all controls from the dialog... and only the VK_RIGHT and VK_DOWN don't work...
but thanks... I try it with WM_GETDLGCODE
|
|
|
|
|
Hi.
I have a problem with using CTreeCtrl.
How Can I Get Expanded item in "OnExpanding(...)" event, when user
click on '+' and no any item selected.
Pleas with more details.
Iman Ghasr-e-fakhri
|
|
|
|
|
Cast NMHDR* to NMTREEVIEW*. itemNew member of NMTREEVIEW contains information about tree item that expands or collapses.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hello !
please help me
how to transpose all note while playing midi by directmusic ?
thanks
|
|
|
|
|
I have a simple Dialog based application in which I am using 2 embedded web controls (Microsoft web browser)as UI.
The problem is if I want my web page in control 1 to change page in contorl 2, how can i do it.
This is basically a communication between those two embedded web controls.
In my dream, I was dorwning in my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
How can I get the path of the executable? I want to Open a file in the same directory - the problem is that something causes the relative directory to change, so just specifying the filename can give me a FileNotFound exception.
thanks,
Jake
*****
Jake Palmer
www.duke.edu/~jp6
|
|
|
|
|
Its easy.
use function GetModuleFileName like this
char szFileName[MAX_PATH];<br>GetModuleFileName(NULL,szFileName,MAX_PATH);
but you want to know the directory of your file you can use function GetCurrentDirectory like this
char szFileName[MAX_PATH];<br>GetCurrentDirectory(MAX_PATH,szFileName);
Secondly you may be having this problem because you are executing the file from within visual c which makes the parent folder the working directory and not the "Debug" or "Release" folder of your project.
Put the file you want to access in the parent of your "Debug" folder.
In my dream, I was dorwning in my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
Since GetModuleFileName(...) has some restrictions when used under Win9x, I prefer to evaluate the public variable CWinApp::m_pszHelpFilePath.
|
|
|
|
|
Hello!
I'm creating my very first ActiveX Control! I'm using the AppWizard to create the project.
I then changed the code in OnDraw so that the CRect allways is a square. I then use FillRect() and Ellipse() to create a white box with a circle in it. (I'm just trying this)
When I then insert this Control into VB (or ...) I get a box, with 'handles', around my square, for resizing it.
When I resize it the white box with the circle will be a square, BUT the box around it has the size it got when I used the mouse to resize it. This often leads to that only a part of my white box and circle will be shown!
How do I change the sorrounding box
|
|
|
|