|
Dear friends
I am new to VC++ and I need to display a bitmap file which i stored as an resource file or u can consider it as an input file. I want to do it using Win32 API.
Will you please give me provide me any such file's complete .dsw file. It will be very helpful to me. I don't have much time, charles petzold book have so many such files but at present i don't have that book and i have to submit this project in 1-2 days. Please help me and do the needful.
Thanking you in advance.
Binay
|
|
|
|
|
HBITMAP hBitmap;
CClientDC dc(NULL);
CString szBmpFile(_T("..."));
hBitmap = (HBITMAP)LoadImage(AfxGetInstanceHandle(),szBmpFile,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
BITMAP bm;
CDC dcMem;
::GetObject(hBitmap,sizeof(bm),&bm);
dcMem.CreateCompatibleDC(pDC);
HBITMAP pOldBitmap = (HBITMAP)(dcMem.SelectObject(hBitmap));
CRect rect
pDC->BitBlt(Rect.left,Rect.top,bm.bmWidth,bm.bmHeight,&dcMem,0,0,SRCCOPY);
|
|
|
|
|
Dear Wangyiming
Thanks a lot for ur response.But I want to get a complete source code or complete .dsw file. I always refer Charles Petzold for basic programming code. here I don't have that book. So please give me such file which is a reads one .bmp file and displays it by getting hdc. It will be a great help to me at this time. I don't have time and have so much tension. Kindly help me.
Thanking you in advance.
Binay
|
|
|
|
|
DEar Wangyiming
Thanks for ur code. I want to a complete .dsw file. I always refer Charles Petzold book fo basic programming code. So please give or send me any such file which reads a bitmap file and then display it after getting hdc.
Thanking you in advance.
Binay
|
|
|
|
|
Dear friends
I am new to VC++ and I need to display a bitmap file which i stored as an resource file or u can consider it as an input file. I want to do it using Win32 API.
Will you please give me provide me any such file's complete .dsw file. It will be very helpful to me. I don't have much time, charles petzold book have so many such files but at present i don't have that book and i have to submit this project in 1-2 days. Please help me and do the needful.
Thanking you in advance.
Binay
|
|
|
|
|
Hi,
#define GetRandom(min, max) ((rand() % (int)(((max) + 1) - (min))) + (min))
I found this algorithm from this discussion forum. However, i found that every time it produces the same "sequence" of output. For example, GetRandom(2, 100), the sequence is 43, 55, 99, 69, 64, 84, 95, 56...............
Since i'm doing multithread, my threads get the same result when they call it.......... so...............can anyone help me???
Thanks!
|
|
|
|
|
rand is a psuedo-random number generator. That means that the same sequence of numbers will be generated each time you use it in an application, however, the sequence of numbers that it generates are uniformly distrubuted. Which means that they are essentially random.
You can make the sequence become random each time you run your app if you seed the number generator with the srand() function when your app or thread starts up. The current time may be a good value to use to seed the number.
|
|
|
|
|
Anonymous wrote:
i found that every time it produces the same "sequence" of output.
If you use Srand() before your random function,then this won't happend.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Sorry, I don't quite understand how to use srand()????
i found this in MSDN: ( and i implement in my program)
srand( (unsigned)time( NULL ) );
GetRandom(2,100)
but everytime i run it.............it is increasing order.......until 100.......
e.g.
31, 33, 33, 35, 38, 42, 47.......89, 99, 3, 5, 10, 15, 22....
What is the problem then?
|
|
|
|
|
Use srand( (unsigned)time( NULL ) ) only once at the beginning of the program to "randomize" the sequence generated by GetRandom . Do not use it every time you call GetRandom .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks....it works now!!!
|
|
|
|
|
I am working on a custom drawn menu. I am able to get the rect of the menu items, but the rects coordinates are not in relation to the screen. How can I get the menu items cords for the screen?
|
|
|
|
|
Try using ClientToScreen
Nish
I am looking for a free racing game. Old style racing game without any complicated 3D stuff. Around 4 MB download. If anyone has such a game, please inform me.
|
|
|
|
|
Thats what I thought too, but CMenu is derived from CObject not CWnd. So how do I get the window handle for the menu. Is that even possible?
|
|
|
|
|
Maybe GetMenuItemRect will help? It returns a rectangle using screen coordinates.
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Perfect... One more question. Is there an equivilant function to get the rect of the whole menu not just each item?
|
|
|
|
|
How to change an int variable to cstring, so that i can post it using AfxMessageBox....
|
|
|
|
|
CString str;
str.Format("%d",5);
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I am a novice student who's trying to learn MFC.
I am trying to access a chipset using i2c.
When I download about 6k byte of information through i2c in DOS program it takes less than 10 seconds, but when I program a download program with MFC, it takes more than 2 minutes to download through i2c.
Please someone tell me what I am missing here, or recommand me a book or something that I can solve this problem.
Thank you
|
|
|
|
|
Hello,
I am trying to convert a large integer(in a string form) to integer using StrToInt64Ex function. MSDN suggests that this function is defined in shlwapi.h, but it is not defined. I am using Visual C++ 6.0 on windows 2000. Source code is enclosed with the error message here below. Please someone tell me what is wrong with this code ? Is there any other method to convert a large integer? How to proceed further?
Thank you.
Regards,
Mainak.
==============================================================================
#include <windows.h>
#include <Shlwapi.h>
#include <stdio.h>
#include <stdlib.h>
int main ()
{
// with StrToInt64Ex
__int64 a2;
char s2[] = "0xffff";
LONGLONG a3;
StrToInt64Ex (s2, STIF_SUPPORT_HEX, &a3 );
return 0;
}
Compiling...
main.cpp
C:\tmp\str\main.cpp(19) : error C2065: 'StrToInt64Ex' : undeclared identifier
Error executing cl.exe.
str.exe - 1 error(s), 0 warning(s)
==============================================================================
|
|
|
|
|
This is only supported for IE 6.0 or higher. You'll need to add:
#define _WIN32_IE 0x0600
to stdafx.h before the other includes.
(If you look at shlwapi.h you'll see it's wrapped in ifdefs for this value)
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
I upgraded to IE 6.0 still it did not compile.
The header shlwapi.h (version 1) does not have the
function proto. What is your PC configuration?
-Mainak
|
|
|
|
|
|
Instead of StrToInt64Ex, which isn't supported on older Windows version, use plain old sprintf with %I64x or %I64d format specifiers:
char buf[32];
__int64 v;
v = 0x1234567890abcdef;
sprintf(buf, "%I64x", v);
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
how do i implement cpu scheduling using the multilevel feedback priority queues? i have 4 io devices and one cpu
abbas
|
|
|
|