|
How are you allocating your array and what does your structure look like?
|
|
|
|
|
Thanks.
The array list is typical. The data class contain integer and character as in numbers and names.
Anyways, I can try different ways to modify it.
Kuphryn
|
|
|
|
|
I would like to search a string in another string, by using a Windows API or a C function (not MFC).
Does a such function exist or not ?
Appstmd
|
|
|
|
|
char *strstr( const char *string, const char *strCharSet );
string = Null-terminated string to search
strCharSet = Null-terminated string to search for
|
|
|
|
|
|
For the real guru:
How can I - if at all possible - instantiate a Web Browser Control in a window, not using MFC?
I'd really appreciate something in the form of
CreateWindow("Class_Webbrowser", ...
but I have a faint feeling that's not all there's to it...
Comments please!
Georg Haan (.NETherlands)
|
|
|
|
|
I have to question about srand() :
First:How can I get random number between 1 and 20.
Second:I need to get numbers between 1 and 20 randomly,I mean for example when I get 15 for the next times I don't get 15,does anybody have any solution for this?
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
|
|
|
|
|
srand delivers a number between 0 and <insert very="" large="" int="" here="">
to break it down to a number 1 - 20 you must modulate it.
the operator for that is %
better explained:
4 % 3 = 1
'%3' means as much as 'deduct 3 until I have a number less than 3'
0%3=0
1%3=1
2%3=2
3%3=0
4%3=1
5%3=2
6%3=0
etc.
srand()%20 will give you a number between 0 and 20.
to get a number between 1 and 20 use this:
(srand()%19)+1
BTW, a few months back I saw a CMersenneTwister class here on the codeproject. You might want to take a look at it, it's a better random number generator...
Georg Haan (.NL)
|
|
|
|
|
Thsnkd for your tips
Georg Haan wrote:
a few months back I saw a CMersenneTwister class here on the codeproject
couldn't find it can you tell me ni which section it was?
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
|
|
|
|
|
Don't use % to generate random numbers between 0-n. It doesn't produce an even distribution.
http://www.math.keio.ac.jp/~matumoto/emt.html
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
try this one:
#define GetRandom(min, max) ((rand() % (int)(((max) + 1) - (min))) + (min)) //get a random number between min and max
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
If you decide to use rand as your number generator and modulate the results to be between 1-20, you will only want to seed the number generator with srand at the beginning of your application.
After that you want to use rand in order to get a normal distribution.
|
|
|
|
|
i have a Ansistring called Output and i need to search it but find is a string command so i have to convert it to a string:
string Oputput;
but this changes what is in the AnsiString? any ideas
|
|
|
|
|
Are you talking about the C++ builder AnsiString? Doesn't that class have a find member function?
|
|
|
|
|
yes i am talking about C++ builder but i dont know about the second bit? i know how to search a string but not an AnsiString?
|
|
|
|
|
Can Anyone tell me whats wrong with this code because it just crashes the program.
TCHAR sFilePath[MAX_PATH] = {NULL};
TCHAR sFileName[STRING_LENGTH];
DWORD dwFilePathSize;
TCHAR sFilter[STRING_LENGTH] = {"Bitmap \0 *.bmp \0 \0"};
OPENFILENAME OpenFile;
LPITEMIDLIST pSelectedFolder;
DWORD dwFileExtension;
DWORD dwFileOffset;
OpenFile.lStructSize = sizeof(OPENFILENAME);
OpenFile.lpstrFilter = sFilter;
OpenFile.hwndOwner = NULL;
OpenFile.nFilterIndex = 0;
OpenFile.lpstrFileTitle = sFileName;
OpenFile.nMaxFileTitle = sizeof(sFileName) - 1;
OpenFile.lpstrInitialDir = NULL;
OpenFile.lpstrFile = sFilePath;
OpenFile.nMaxFile = MAX_PATH;
OpenFile.nFileOffset = strlen(sFilePath);
GetOpenFileName(&OpenFile);
|
|
|
|
|
try this
OPENFILENAME OpenFile;
memset(&OpenFile, 0, sizeof(OPENFILENAME));
|
|
|
|
|
Cheers
Can't belive i missed that.
Peter
|
|
|
|
|
GetMenu always fails when i try to get the menu of my taskbar icon.
CMenu* menu = GetMenu();
if(menu == NULL) // always 0x00000000
return 0;
any ideas what to do ? how can i work with menu items ?
thanx
|
|
|
|
|
I bet you didn't create your window with a menu. Thus trying to get the menu fails.
Just use LoadMenu to get the menu you wish to display from your resource file. Don't forget to get one of the sub menus.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I dont know how to use it ,can you give me a instance??
thanks a lot!!
|
|
|
|
|
Hi Ilavl,
Perhaps you can provide which TransparentBlt() function your using? There is two that I know of. The class CDC has one, CImage has one also and they both take different parameters.
Also one of them has a bad memory leak that can render the system useless. Off the top of my head I can't remember which one or if MS has fixed this or not. A quick search on http://msdn.microsoft.com/ should help. Let me know and I'll help you out. Cheers
|
|
|
|
|
TransparentBlt can be used to paint a picture from one DC (the source) to another (the destination). The special thing about it is, that you can designate a specific color to be transparent. Any pixel on the source DC with that specific color, will not be copied.
It purpose was to supersede older BitBlt hassle with masks.
if you have a DC ready with an image you want to place on a windowDC, and this image has the color black designated as transparent, this code would probably work:
In your message handler:
case WM_PAINT:
TransparentBlt(
(HDC) wParam, // your window DC
0, // Dest. x
0, // Dest. y
220, // width of picture on destination
440, // height of picture on destination
hdcSrc, // Source DC
0, // Source x
0, // Source y
220, // width of picture on source
440, // height of picture on source
RGB(0,0,0) // Macro, specifies the color black
);
if source and destination heights and widths differ, TranparentBlt stretches the source image to fit the size specified for the destination...
If you need more help concerning this, you could, if you like, email me the piece of source you're having trouble with...
Georg Haan (.Netherlands)
|
|
|
|
|
Hello Georg,
Do you know how can i draw transparent image with IPicture object ?
Please help me ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I've created a DLL but how can I call all my functions in that DLL from an EXE?
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|