|
IMHO it depends on what basedata is: If it is a BYTE* , basedata+1 is the BYTE after basedata.
If basedata is of type unsigned short* , basedata+1 is the unsigned short after basedata , and that would be the BYTE basedata+2/+3 .
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
unsign char baseData[4] = {1, 2, 3, 4};<br />
<br />
unsigned short myVal1 = *(unsigned short *)(baseData + 1);<br />
unsigned short myVal2 = *(unsigned short *)(baseData + 2);
for little endian system:
myVal1 = baseData[1] + baseData[2] * 256,
myVal2 = baseData[2] + baseData[3] * 256
for big endian system:
myVal1 = baseData[1] * 256 + baseData[2],
myVal2 = baseData[2] * 256 + baseData[3]
For some systems, such accesses would cause problems: data alignment violation or resulting unpredictable values
elkarian@hanmail.net
|
|
|
|
|
Hi,
i need highly optimized image(bitmap) processing classes. There are lots of scaling, shadowing, blurring, warping and pixel-manipulating operations for my OwnerDrawn Inerfaces. I can use GDI / GDI+ (when XOR mode is possible again) / DirectDraw,Direct3D or the Intel IPP Package(comparatively cheap). Which is the best one? I use only INTEL processors, so the CPU dependence (IPP) does not matter.
Thanxs !
Marco
|
|
|
|
|
Hello !!!
How to get system date and time in C?
How to save this date and time in MYSQL database?
Samhita
|
|
|
|
|
|
Hi,
I'm trying to deploy my application that uses the Soap Dll's ( VC++ 6.0 application that calls a web service in a server), ... the problem that I have on clients with 98:
- If I install IE 6.0 and the Soap Tool it all works fine ( altough... the user becomes a bunch of programming tools .. tracers and... ).
- If I try to install IE 6.0 and then soap_core.msm, it doens't work at all , in theory soap_core.msm should be what I need to deploy my application but... what I'm missing here ?
Greetings
Braulio
PS.: Is not very professional to install on the clients machine a Trace Utility, WDSL Generator, and documentation XDDD...
|
|
|
|
|
I need to program UART in Visual C++ to acquire serial data from a hardware
device can some one please help me in this context...
Ever Welcome...
|
|
|
|
|
|
Hi all,
I have a dialog with the followings:
1) it is a modal dialog
2) it is always on top
3) it has no frame (style = popup, border = none)
my question is this, when the dialog has focus (which means i am clicking over it or moving my mouse over is) i want to do one thing, but when the focus leaves the dialog (click somewhere else, or move mouse somewhere else) i want to do something else.....
i tried to catch these messages and it didn't work properly:
1) WM_SETFOCUS/ WM_KILLFOCUS
2) WM_ACTIVATE / WM_ACTIVATE_APP
can any1 help me here?
thanks in advanced
Yaron
|
|
|
|
|
Try SetCapture to get mouse input even if it's outside of your dialog.
To act only once when mouse cursor leaves dialog area try to catch WM_MOUSELEAVE, WM_NCMOUSELEAVE.
Hope that's what you need.
Mickey
|
|
|
|
|
hi,
thanks for reply.
I don't know how to catch these messages, can you show me?
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
In your derived class MESSAGE_MAP section
BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
ON_MESSAGE(WM_MOUSELEAVE,OnMouseLeave)
END_MESSAGE_MAP()
Mickey
|
|
|
|
|
thanks
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
I want to do some test about keyboard loging without using hook api. in the following codz, i hope when i press Esc key, the prog will com to an end. but it seems PeekMessage() will never work, always failed. How could it be? Thanks a lot.
#include "windows.h"
#include "stdio.h"
void main()
{
MSG msg;
char buffer[10];
int i, ch;
while(true)
{
if( PeekMessage( &msg,
NULL,
0,
0,
PM_REMOVE))
{
if( msg.message == WM_KEYDOWN && msg.wParam == VK_ESCAPE) break; //Esc pressed, then quit
printf( "Enter a line: " );
/* Read in single line from "stdin": */
for( i = 0; i < 9; i++ )
{
ch = getchar();
if(ch != '\n') buffer[i] = (char)ch;
}
/* Terminate string with null character: */
buffer[9] = '\0';
printf( "%s\n", buffer);
*buffer=NULL;
}
else
printf("peekmessage failed...\n");
Sleep(3000); //ensure there is enough time for keyboard operations
}
}
|
|
|
|
|
Console Applications don't recieve windows messages.
|
|
|
|
|
thank you so much. but can i use a keyboard or mouse hook api in console applications?
|
|
|
|
|
No.You can't do that either.
|
|
|
|
|
|
In CFileDialog, How to make the EditControl which displays selectd file name, Read Only??
My problem is its accpeting a file name if user types file name rather than selecing.
Thanks in advance
|
|
|
|
|
dear all,
how can i retrieve the path of My Documents folder for specific users (say guest) ? is there any function which returns the path.
my documents folder has different location in windows 9x and Xp........any way out?
rIsHaBh
|
|
|
|
|
LPITEMIDLIST pidl;<br />
<br />
HRESULT hr = SHGetSpecialFolderLocation(NULL, , &pidl);<br />
<br />
char szPath[_MAX_PATH];<br />
SHGetPathFromIDList(pidl, szPath);<br />
<br />
LPMALLOC pMalloc;<br />
<br />
hr = SHGetMalloc(&pMalloc);<br />
<br />
pMalloc->Free(pidl);<br />
<br />
pMalloc->Release();<br />
<br />
strcat(szPath , "\\Folder");
|
|
|
|
|
Or even simpler:
if ( SHGetSpecialFolderPath( NULL, pszMyDocFolder, CSIDL_PERSONAL, FALSE ) )
return pszMyDocFolder;
or:
if( SUCCEEDED( SHGetFolderPath( NULL,
CSIDL_PERSONAL,
NULL,
0,
pszMyDocFolder
)
)
)
{
return pszMyDocFolder;
}
depending on which version of the SDK you have installed.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
|
Hello, everyone!
I want to get the current bandwidth (input and output respectively) of a Windows system, for example, 20.2kB for input and 30.1kB for output.
Where can I find some sample codes?
Thanks in advance,
Geo
|
|
|
|
|
For Windows NT-based systems, look at the Performance Data Helper API. You'll be interested in the Bytes Received/sec and Bytes Sent/sec counters on the Network Interface object, I think.
|
|
|
|