|
Hi, I´m quite new at programming C++. Can someone please tell me how I can initialize an array with random generate characters ?
|
|
|
|
|
char array[size];
for (int i = 0; i < size; i++) {
array[i] = (char)((rand() * 255) / RAND_MAX);
} The calculation scales the return value of the rand() function, which returns a value in the range 0 to RAND_MAX to the range 0 to 255.
Software Zen: delete this;
|
|
|
|
|
|
Maybe asking these questions on the managed C++ forum[^] will get you a better response.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Hello
I am a new member of this group. I looked at previous messages and files uploaded but cant find exactly how towrite a code in excel visual basic editor that can dictate what ı said to a text box or other controls..
ı managed to write the code that can run commands but it works only with specific words that ı write to a Gramer file
can u show me an example that is able to translate every word in english to text file....
how shoud ı change the code
directsr1.grammarfromstring
by the way I am using Microsoft Speech SDK
Mustafa
|
|
|
|
|
What on earth does this have to do with C++ ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote: What on earth does this have to do with C++ ?
I strongly agree with Christian Graus. It will be just a waste of time to post doubts and questions in an inappropriate forum.
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
cool man nothing to worry
dip
|
|
|
|
|
Hello,
I am building an application using WebBrowser control (IE6 XPSP2 - Borland C++ Builder 6) and managed to register a NameSpace to pass html data "manually" (IInternetProtocol::Read) to the control every time it asks for something , it works fine for the html contents and images but when i try to load a Flash file (swf) it doesnt load i pass the buffer with the loaded swf file to the Read method, IInternetProtocol, just like i do with images/htmls but the flash movie will not load ... i can see the ActiveX loaded on my WebControl but the movie doesnt show and when i right click where the flash movie it was suposed to be i get the context menu with the disabled option: "movie not loaded" If i let the webBrowser manage the html page (INET_E_USE_DEFAULT_PROTOCOLHANDLER) it loads the flash file but i want to load the data from memory not from http:// or local file
Can some one help a fellow coder resolve this problem ?
Thank you for reading my post and i hope you can help me,
have a nice day coding
---
Regards from Romania,
Razvan Serban
-- modified at 11:18 Monday 28th November, 2005
|
|
|
|
|
when my c++ app is running in user's PC, I hope the app can send user's info into my mysql database in my web-site.
but problem is that user can not access to my mysql database because user's IP address is not added to my mysql database.
do you have any idea to solve the problem?
or I have to use php etc?
thx
includeh10
|
|
|
|
|
Hello,
If you mean that you want to connect to the database and execute some SQL statements, you should start looking here[^]
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
your suggestion equals zero.
includeh10
|
|
|
|
|
includeh10 wrote: do you have any idea to solve the problem?
Two different options the way I see it,
Create a client server environment, or use a web form to interact with the database. Your app could fill in the web form and submit it to the db.
ZeePain! wrote: This seems like one of those programs that started small, grew incrementally, building internal pressure, and finally barfed all over its source code sneakers. Or something.
thedailywtf.com[^]
|
|
|
|
|
Hey,
I'd like to draw a line while the mouse is moving (like CRectTracker). How can I do this?
I tried to draw the line in OnMouseMove and call InvalidateRect() but then the screen flickers...
|
|
|
|
|
One golden rule in windows drawing is that NOTHING is stored when you draw something on your window !! So, when you call InvalidateRect, it will repaint your window and thus erase what you did. This is something really important and you have to remember whenever you want to make drawings on a window.
Now, the way to 'solve the problem': when you should normally draw your line (in your case, probably in OnMouseMove), instead of directly drawing on the screen, save in your class what need to be drawn (the coordinates of the start and end points of your line). Then call Invalidate. This will result in calling (indirectly) the OnPaint function. In this function, you will do the drawing ! So, like that, even when your windows is repainted due to external events (when your window has been hidden and then visible again for exemple), your data drawn on screen won't be lost but redrawn again each time instead.
Hope this is clear
|
|
|
|
|
How to save the coordinates in the class ,i did not get that?
I am having a same problem
|
|
|
|
|
Use SetROP2(R2_XORPEN) so that redrawing the line in the same spot twice causes the line to be erased. I use a seperate function for this
void CMyWnd::DrawLine(CPoint Start, CPoint End)
{
CClientDC DC(this);
int s = DC.SaveDC();
DC.SelectObject(GetStockObject(WHITE_PEN));
DC.SetROP2(R2_XORPEN);
DC.MoveTo(Start);
DC.LineTo(End);
DC.RestoreDC(s);
} Using a white pen causes the line to be drawn using the inverse screen colour. Redrawing the same line again causes the colours to be inversed again resulting in the original colour, or the line being erased.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
"holder = GetProcAddress(library,_T("Build"));
mention the function ordinal in place of _T("Build")" - sunit5
Ok so I'm still having problems but I think sunit may have solved them. I just don't know how to pass the ordinal value using LPCSTR so that GetProcAddress will understand what I'm even talking about. Thank you in advance for any help you can give.
|
|
|
|
|
According to MSDN[^]'s description of the lpProcName parameter "If this parameter is an ordinal value, it must be in the low-order word; the high-order word must be zero". The MAKEINTRESOURCE[^] macro will convert the ordinal number you supply into the proper format.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Are you sure you want to use MAKEINTRESOURCE , since it's intended for resource ID's and not DLL ordinals? Given the description of GetProcAddress , you can just pass the ordinal value in the lpProcName parameter, suitably cast to LPCSTR . I've never used ordinals with GetProcAddress , since they're so sensitive to changes.
Software Zen: delete this;
|
|
|
|
|
I never use ordinals either. I just read the description from MSDN on how to use ordinals, and it is identical to how to use numbers to load resources. So I realized the MAKEINTRESOURCE would do the trick.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Hi all,
I've tried to find out the size of the client area of a MDI application. To me, the client area means the (application window size) - (tool bar size) - (status bar size) - (menu bar size). Usually, the size of this area can be retrieved by calling the function GetClientRect() of the ParentFrame of a View. However, I want to know the size of the area prior to the creation of a Document/View instance. I cannot call the GetClientRect() function because the ParentFrame object doesn't exist yet.
Does somebody know how to solve this?
Regards,
Willem
|
|
|
|
|
Any one know how to detect if a fullscreen application is running (for example: game, video, pp presentation, etc...)
thanks in advance...
|
|
|
|
|
You can get the active window handle (see GetActiveWindow function) and check the size (GetWindowRect function)
good luck!
Regards from Romania,
Razvan Serban
|
|
|
|
|
thx
|
|
|
|