|
did u see ur bitmap at least for once?
if yes, is the line correct:
wc.hInstance = ::GetModuleHandle(NULL);
?
why do not use
wc.hInstance = hInstance;//which is one of params of proc
?
A special image tool for C++ programmers, don't miss it!
The world unique Software Label Maker is here for you and me ...
A nice hyper tool for optimizing your MS html-help contents.
|
|
|
|
|
hi again
yes, the bitmap is drawn. the prob is, when i first minimize the window and then bring it back to the screen (via clicking on it in the taskbar) the client area (the bitmap) is not redrawn, the area is white. Its only drawn again when i move the mouse over the window or when I move another window in front of it (so i guess when WM_PAINT is called).
I used GetModuleHandle(NULL) because actually the window creation is in another method (which is called from winmain). But still, I tried your suggestion and it doesnt solve my problem. Any other tips? Thanks a lot
|
|
|
|
|
last tip, I have no more.
if it is called from WinMain(), why do not pass hInstance from WinMain() to the function which contains ur code above?
such as:
MyCreateFunction(HINSTANCE hInstance);
A special image tool for C++ programmers, don't miss it!
The world unique Software Label Maker is here for you and me ...
A nice hyper tool for optimizing your MS html-help contents.
|
|
|
|
|
yes thanks, i did that but it doesnt solve the problem
|
|
|
|
|
Hi naal11,
Whats m_pBits, &m_BMI? Can you be more specific
But if you use WM_PAINT for show bitmap I think It's not problem
I run and then Min and Max window but bitmap is fix.of course I use
BitBlt.
-----------------------------------------
please try
InvalidateRect(hWnd,&rect,1);
|
|
|
|
|
m_pBits it a pointer to the pixeldata. m_BMI is the BITMAPINFO -struct. But these things shouldnt be the prob since drawing the bitmap works. I tried InvalidateRect(hWnd,NULL,1) but its still not working. I even tried painting into the device context (SetDIBitsToDevice...) inside the WM_SIZE case but no effect. thanks for your help
|
|
|
|
|
naal11
please try
RECT rect;
GetWindowRect(hWnd,&rect);
InvalidateRect(hWnd,&rect,1);
InvalidateRect(hWnd,NULL,1)
|
|
|
|
|
msdn docs say that by passing NULL the entire client area is invalidated. but i tried it your way and it doesnt work
thanks anyway
|
|
|
|
|
naal11 wrote: SetDIBitsToDevice (hDc, 0, 0, w, h, 0, 0, 0, h, m_pBits, &m_BMI, DIB_RGB_COLORS);
should it not be SetDIBitsToDevice (hDc, 0, 0, w, h, 0, 0, w, h, m_pBits, &m_BMI, DIB_RGB_COLORS);
Also try calling InvalidateRect from your WM_SIZE handler.
|
|
|
|
|
Well its 0 cause 0 is the first scanline. Probally if that wasnt correct i wouldnt see the bitmap at all, but it works. Its just that repainting problem after i restore the window.
I tried InvalidateRect(hWnd,NULL,1) but its still not working. I even tried painting into the device context (SetDIBitsToDevice...) inside the WM_SIZE case but no effect. thanks for your help
|
|
|
|
|
1/ Are you overriding WM_ERASEBKGND?
2/ Do you redraw, if you do something boring like:
TextOut (ps.hDC, 0,0, "Hello", 5); (probably not the
right order for the params...
That should narrow the problem to a missing WM_PAINT message,
or bad bitmap drawing...
Iain.
|
|
|
|
|
1) im not catching wm_earasebkgnd
2) no i only redraw the bitmap in wm_paint
best regards micimausi
|
|
|
|
|
Maybe I located the prob by myself now. Could it be this message loop? When i outcomment "Waitmessage()" the desired repainting occurs. Could someone explain me whahts going on with this Waitmessage call?
Thanks
while(true)
{
if(PeekMessage(&Msg, NULL, 0, 0,PM_REMOVE))
{
if(Msg.message == WM_QUIT)
{
break;
}
else
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
WaitMessage();
}
|
|
|
|
|
I want to transfer bitmap over socket. For that I need pixel buffer retrieved from bitmap and I use GetDIBits. When I debug, I get the nLength value equivalent to the height of bitmap. but all the values of lpvBits array are 0.
What I am doing wrong. Any help
LPBYTE lpvBits = (LPBYTE) GlobalAlloc(GMEM_FIXED, pbmi->bmiHeader.biSizeImage);
int nLength = GetDIBits(hdc,hCaptureBitmap,0,(WORD)pbmi->bmiHeader.biHeight,lpvBits,pbmi,DIB_RGB_COLORS);
Also can someone please tel me is it the correct method for transfering a bitmap
over socket. or theres a better/correct method.
Thanx alot
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg."
- Bjarne Stroustrup
|
|
|
|
|
i think it is easier to open bitmap file directly if allowed.
u should zip the file - file size of bitmap is to large too be transfered by socket.
and, how does receiver decode info if without BITMAPINFOHEADER?
A special image tool for C++ programmers, don't miss it!
The world unique Software Label Maker is here for you and me ...
A nice hyper tool for optimizing your MS html-help contents.
-- modified at 13:02 Saturday 8th April, 2006
|
|
|
|
|
Identity Undisclosed wrote: Also can someone please tel me is it the correct method for transfering a bitmap
over socket. or theres a better/correct method.
depends on the size of the image. You can send a single image as a raw packet, but you have to remember not to exceed the maximum packet size for your socket library. Any socket based packet is divided into MTU (usually 1500) byte sized packets and delivered one at a time. In UDP if all packets are received then the receiver gets the full sized packet, if any one is missing the packet is ignored (UDP is non-guarenteed delivery), TCP will exchange and verify every piece one at a time, when all are verified the packet is delivered (or connection times out if it takes too long).
There is no "correct way" there is only each programmer's preferred way, which is often application based. If you are sending video frames, you may not care about reliable transmission, just wait for the next frame.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Hi everyone.
I need to globally monitor the entire system for the message WM_SETFOCUS (to notify when the user change the parent/child window focus on any process of the system)
Any idia what type of hook should i use ? (WH_KEYBOARD, WH_SYSMSGFILTER or WH_MSGFILTER...)
and how the hook procedure should be:
should I cast the LPARAM to CWPSTRUCT, like this:
<br />
CWPSTRUCT *cwpStruct = (CWPSTRUCT *)&lParam;<br />
if (cwpStruct->Message == WM_SETFOCUS)<br />
....<br />
Is that right ?
Any help would be appreciated.
|
|
|
|
|
I'm having an annoying link error:
Linking...
Source.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in DataInput.obj
cCrypt.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in DataInput.obj
Debug/Student Data.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
Student Data.exe - 3 error(s), 0 warning(s)
Before anybody states the obvious yes I do know what it means. I have char Password[50]; defined in cCrypt.h as a global variable. It is referenced as extern char Password[50]; in DataInput.h, and not even mentioned in Source.h. All my header files have the appropriate #ifdef #endif blocks, yet the compiler will not let me build.
I have had this error in the past, the only fix I could find was to rename the variable, try to compile (still with the errors) then rename it back. The link errors magicaly went away, but it is not working this time. Strange thing this time, if I declare it in Source.h and refrence it in the other files, it gives me no problems. But there is no need for it to be in the Source.h.
Is this a common problem? Bug in Visual Studio? how to get rid of it?
|
|
|
|
|
|
Yes I read this quite some time ago, along with all the other reports on this error. I managed to rid the link error by declaring it as static. But now I am having problems initialising it.
I'm using a dialog box for the user input of a password. I pass this Password viariable in a SendMessage to an edit box, get the password, then call EndDialog passing the string length as the return val. Strange thing is, even though there is now text in the variable, the Dialog box returns 0. To make things even more confusing, on checking the Password variable, immediatly after the dialog has ended, it has no memory address.
I have had enough of VS6, I seem to spend more time trying to find the cause of stupid errors than I do coding.
|
|
|
|
|
Linking...
cParse.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
DataInput.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
Print.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
Source.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
cParse.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
DataInput.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
Print.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
Source.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
Debug/Student Data.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
Student Data.exe - 9 error(s), 0 warning(s)
@$^* MS *^$%#& VS **(%^ Bill ^& Gates $^%
|
|
|
|
|
Hi waldermort,
Nothing better than is in MSDN(more symbols)
Do you test /FORCE or /FORCE:MULTIPLE ?
(I had this problem but I can't find this problem in my program excatly like you)
I dont find so I created this error!!
ppp error LNK2005: "int a" (?a@@3HA) already defined in ppp.obj
I insert /FORCE then in (property)
ppp warning LNK4006: "int a" (?a@@3HA) already defined in ppp.obj; second definition ignored
Now this program is run
--------------------------------------------------------
I created a program and I declare a variable in header program(ppp.h)
then I insert a file cpp(exmplae test) and insert include from main program(ppp.h) and I get this error.
maybe it is some helpful to you
|
|
|
|
|
I remember trying it last time to no effect, and to be honest I have made too many changes to try it again now. I had to add the variable as a class member instead of in the global scope. It's not really what i wanted but at least it's working.
|
|
|
|
|
waldermort
if you can change to another way I suggestion that you change to it and compelete your program quickly,
But (again I suggestion) that you back and see how to solve this error
|
|
|
|
|
If you #include cCrypt.h in more than one place, you're duplicating the global definition of the variable Password . That's probably causing the multiple definition errors.
As a rule, if you are using global variables, always make them extern in your header files. Then place a definition, without the extern keyword, in the appropriate .cpp file.
Software Zen: delete this;
|
|
|
|
|