|
static DWORD CALLBACK readbuff(
DWORD dwCookie, // (in) pointer to the string
LPBYTE pbBuff, // (in) pointer to the destination buffer <============
LONG cb, // (in) size in bytes of the destination buffer
LONG FAR *pcb // (out) number of bytes transfered
)
"pbBuff" the destination buffer .....
|
|
|
|
|
one obvious question I missed, are you going from the rich-edit-control to a file (stream out/output) or reading a file into the rich-edit-control (stream in/input) - the
ForNow wrote: Myricheditctrlptr->StreamIn(SF_RTF, es);
tends to suggest you're loading the rich-edit-control from a file, but it pays to be sure..
so does it not work the way this link suggests >> http://msdn.microsoft.com/en-us/library/h2hkhzhe(VS.80).aspx[^]
'g'
|
|
|
|
|
THANK YOU !!!!!!!!!!!!!!!!!!!!!! changed from SF_RTF to SF_TEXT
came back ok
|
|
|
|
|
Hey, i hope you can help me with my question:
I started learning working with DirectX, in the start i saw a codeexample for how open an empty window (without chosing winn app at the start of Visual Studio)
but for some reson, the code makes me problems, hope you can say to me why
code
#include <windows.h>
HINSTANCE hInst;
HWND wndHandle;
bool initWindow( HINSTANCE hInstance );
LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM );
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow )
{
if ( !initWindow( hInstance ) )
{
return false;
}
MSG msg;
ZeroMemory( &msg, sizeof( msg ) );
while( msg.message!=WM_QUIT )
{
while (GetMessage(&msg, wndHandle, 0, 0) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
return (int) msg.wParam;
}
bool initWindow( HINSTANCE hInstance )
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = 0;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = "DirectXExample";
wcex.hIconSm = 0;
RegisterClassEx( &wcex );
wndHandle = CreateWindow(
"DirectXExample",
"DirectXExample",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
640,
480,
NULL,
NULL,
hInstance,
NULL);
if (!wndHandle)
{
return false;
}
ShowWindow(wndHandle, SW_SHOW);
UpdateWindow(wndHandle);
return true;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
Errors:
Error 1 error C2731: 'WinMain' : function cannot be overloaded c:\users\יהב\documents\visual studio 2008\projects\learningdirectx\learningdirectx\winmain.cpp 11 LearningDirectX
Error 2 error C2065: '“DirectXExample”' : undeclared identifier c:\users\יהב\documents\visual studio 2008\projects\learningdirectx\learningdirectx\winmain.cpp 56 LearningDirectX
Error 3 error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [15]' to 'LPCWSTR' c:\users\יהב\documents\visual studio 2008\projects\learningdirectx\learningdirectx\winmain.cpp 71 LearningDirectX
Sorry to ask but please try to help me (I couldnt solve it for hours before i came here)
Thanks and good day, Yahav.
Gindi Bar Yahav - Web & Software defeloper.
|
|
|
|
|
not sure right now about the winmain part it looks correct.
The DirectXExample has to be a registered class name when you pass it to CreateWindow, it's not just some text you specify.
from MSDN:
lpClassName:
Pointer to a null-terminated string or a class atom created by a previous call to the RegisterClass or RegisterClassEx function.<br> The atom must be in the low-order word of lpClassName; the high-order word must be zero.<br> If lpClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx,<br> provided that the module that registers the class is also the module that creates the window. <br>The class name can also be any of the predefined system class names. <br>For a list of system class names, see the Remarks section.
|
|
|
|
|
Gindi Bar Yahav wrote: Error 2 error C2065: '“DirectXExample”' : undeclared identifier c:\users\יהב\documents\visual studio 2008\projects\learningdirectx\learningdirectx\winmain.cpp 56 LearningDirectX
It looks like you're using some abnormal quotation marks around your string constant; make sure you're using regular quotes and not smart quotes. Aside from that, make sure you're not compiling the program as UNICODE (unless you want to change your WinMain function to _tWinMain and wrap all your string constants with the TEXT(...) macro.)
|
|
|
|
|
Thanks!! you solved me the problem.
i clicked properties and the "charset" was unicode, so i changed to multy-byte charcters (its ok?) but now its compiling me with no error, now i can go back to learn, thanks.
Gindi Bar Yahav - Web & Software defeloper.
|
|
|
|
|
|
|
|
|
|
jeron1 suggested a very good article, indeed.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I didn't I rated his post, however that is not my problem
(if you read my question) my issue is I need something such as BitConverter (in c#) in c/c++
|
|
|
|
|
Your question looks actually arising from a endianess problem; I doubt that a BitConverter -like class would be of any help.
Probably if you elaborate it a bit then we might properly appreciate your issue.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Your question looks actually arising from a endianess problem; I doubt that a BitConverter-like class would be of any help.
Probably if you elaborate it a bit then we might properly appreciate your issue.
? like the question suggests I have converted it from big endian to little, but as stated I cannot just read straight into a double now, i must first grab the data into a char[], convert from big to small, then what I am left with is a char[] filled with binary data.. i need to convert from binary data into a double,int,or float... I could write my own function that would use the mantissa and all that for the float, but I don't think it should be that much trouble and there has to be an easier way of doing it
|
|
|
|
|
Greg Mort wrote: ...what I am left with is a char[] filled with binary data.. i need to convert from binary data into a double,int,or float...
Would a union work?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have seen a few implementations of unions with similar threads, I however seem not to be able to get it to work, then again I have never used unions before
|
|
|
|
|
Never heard about union s?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Greg Mort wrote: you cant read can you?
Yes, I'm able to (as a proof I can see a typo in your sentence... ).
Good luck with your reversed char[] and float .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
This is C++, you don't even need a union , you could just type-pun it directly, from a char[] to a double* or float* or whatever you want. The union isn't any better with Unidefined Behaviour here, only one member of the union is required to have a value at any one time - so it's just as bad as pointer-wise type-punning. Both methods should work anyway.
|
|
|
|
|
Thank you, I just figured this out as well
|
|
|
|
|
|
Looks like an endianess issue.
|
|
|
|
|