|
csrss wrote: i cannot return bytes from function, (this code is a function, which should read a file into BYTE array and return this array among with nr of bytes read).
This has nothing to do with VirtualAlloc .
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
I know it is not perfect :P (the code)
I have never worked with unsigned type allocation before. (the only proper way for returning unsigned type from function i know is to declare buffer size and make this, BYTE, static)
If i pass a pointer to BYTE to this function from calling function, it still returns empty BYTE buffer.
I am out of ideas.
Somebody, help? :P
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
I got it!!! YEah!
*lpdwBytesRead += dwReadBytes;
Its just too much on my head, too much...
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
Everything's good now?
The piece of code I've given above in my other reply doesn't involve any pointer arithmetic.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
For now i have solved the issue with simple text file and one time allocation
Now, it is time to read mp4 file into buffer and make a copy of it :X
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
csrss wrote: lpdwBytesRead += dwReadBytes;
This looks suspect. You are incrementing the pointer instead of what the pointer points to. Is that your intent?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
It was very suspicious in fact! Yes, i have made a disaster mistake and it is corrected by now
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
void Print(const char* s_Format, ...)
{
va_list args;
va_start(args, s_Format);
char s_Out[1024];
sprintf(s_Out,s_Format, args);
Output += s_Out;
FILE *f = fopen("connection.log", "at");
fprintf(f, Output.c_str());
fclose(f);
return;
}
the s_Format is fine but the arguments are not working the string Output; is stored in the header
when i send Print("Sending File: %s\n",fpath); all i get is Sending File: ú· when it should be Sending File: test.ini
even when i do say Print("hello","hello"); i get hello then garbage
|
|
|
|
|
There basically are two ways to work with variable argument lists:
1.
you enumerate the list yourself, using va_arg, as is shown here[^].
2.
or you pass the list to a function that is designed to accept such a list.
sprintf() does not accept a va_list (which describes a list of arguments), it accepts an actual list of real arguments.
what you want here is supported by vsprintf(), see here[^].
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
|
|
|
|
|
yip working perfect i cant belive i missed that one out thanks 
|
|
|
|
|
You're welcome.
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
modified on Friday, June 10, 2011 8:45 PM
|
|
|
|
|
Just downloaded latest version of CP Vanity, great work, congratulations.
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]
|
|
|
|
|
you're welcome 2.
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
|
|
|
|
|
Try this -
va_list args;
va_start(args, s_Format);
char s_Out[1024];
sprintf(s_Out, s_Format, va_arg(args, char*));
|
|
|
|
|
this way also works 
|
|
|
|
|
Hi!
I've to open a web page inside a Dialog(not as a popup) using ShellExecute. I've to use ShellExecute why because Navigate() function works only if IE is present in a System.Is this possible with ShellExecute? Or is there any other alternative?
|
|
|
|
|
|
barneyman wrote: you can't use ShellExecute like that
Ok. I realized that after posting the topic. Now what I want is to open my web page in a separate browser window. I don't want to open inside an already opened window. How to do this with ShellExecute?
|
|
|
|
|
|
I can understand what's said there. But I don't know what parameter values to pass to ShellExecute to accomplish my task. I need some information about parameters(change in coding).
|
|
|
|
|
ShellExecute(NULL, "open", "http://www.microsoft.com", NULL, NULL, SW_SHOWNORMAL);
replace www.microsoft.com with where you want to go to
|
|
|
|
|
This opens inside an already opened window. I want to open the web page in a separate browser window.
|
|
|
|
|
try
ShellExecute(NULL, "open", "http://www.microsoft.com", "-new", NULL, SW_SHOWNORMAL);
|
|
|
|
|
This opens in a new browser window if already an window is not there. If it's there, my web page is opened in the exisiting browser window. Can we have control over the size of the browser with ShellExecute?
|
|
|
|
|
unfortunately, you don't have a lot of control
|
|
|
|