|
As I've never tried it, this is just a guess. I don't think your application will be able to get information about the console window in which it is running. I think you'll need to create another console application that does nothing but call CreateProcess() and redirects the stdin/stdout handles of the child process. See here and here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Dear Ashu,
Increasing the Console Screen buffer may solve your problem. please see the code block below. Please insert this code block at the starting of your program.
#include "Afx.h"
<br />
HANDLE hConsoleOutput = GetStdHandle( STD_OUTPUT_HANDLE );<br />
<br />
COORD stScreenBufferSize;<br />
stScreenBufferSize.X = 300;
stScreenBufferSize.Y = 1000;
<br />
SetConsoleScreenBufferSize( hConsoleOutput,<br />
stScreenBufferSize );
At the end of the program, please add some getch() function which waits for user input and then, take the console window and copy your required data from there.
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
-- modified at 21:38 Thursday 9th March, 2006
|
|
|
|
|
Hi,
I trying to search a silence in MP3 File.
I don´t now how I can make that.
I using the Direct X and Visual C++.
Do you have any idea to help me??
Thks!!!!!
|
|
|
|
|
You would have to decode the MP3 and then look at the resulting waveform for peaks above a certain level.
The tigress is here
|
|
|
|
|
I am just checking out sample code on MSDN as see below, i have created a basic MFC app using the wizard and copying the code below into it and made a few changes for it to run.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/example__getting_wmi_data_from_the_local_computer.asp
in the code "CredUIPromptForCredentials" is called but a dialog doesnt pop up when run.
there is a line of code "cui.hwndParent = NULL;" should that not point to a parent window, how do i point it to a parent window, is it using HWND somehow?
thx
|
|
|
|
|
Can you give a specific of code form your project.
If you want to assign the parent window, please assign the handle of the main window. But I can be more helpful if you can give sepcific of your code
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
We currently determine if a process is running on the local system by openeing the performance data and scanning the 'process' performance data, searching for the name of the EXE in the performance data. There is some overhead with the various registry-function calls, allocating memory, traversing memory, string compare, etc.
Otherwise, you can call EnumProcesses, which then involves OpenProcess and then GetModuleFileName and searhcing the string.
Has anyone else made such a conversion fromt he registry data to EnumProcesses and then regretted such a change because of performance loss, security issues, or otherwise?
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
i developed a program before to monitor processes, but i can not remomber exact code.
the idea is:
1. use EnumProcess() to find all processes
(there are a few of examples in VC samples)
2. Set a Timer to check changes every 2 seconds.
It may not be what u need.
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
Thank you for your reply.
I have done what you suggested in other projects as well, and have a fairly substantial class for enumerating the processes already.
However, I am just wondering (without profiling the two techniques myself myself) which of the two techniques I briefly discussed is faster.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Hello,
am still having a problem with this appending. Am recieving data from a machine two times(i,e total lenght of recieving bytes:212) but am recieving them as length:x1 and length:x2)spliting into two chunks.
count:1 //first chunk of data
length:112//length si varying, not constant, say x1
0x65 0x66 0x67......
count:2// second chunk of data
length:100//length si varying, not constant, say x2
0x23 0x40 0x46 0xcf....
How could i append the length of x2 bytes to x1, so that i should have total 212 bytes.
i would be gald if anyone halps me out from this.
BYTE buffer[1024];
BYTE array[1024];//the output data am recieving from machine is in buffer
for(i=0;i<=lLength;i++)
printf("#%x", buffer[i]);
if(count>1)
array[i]=buffer[i];//am assigning all the buffer values to array if count is greater than 1.
"or" i can use memcpy() also, but there si no result;
is it correct?? but i couldnt get append the whole data? could anyone plz help me for appending
-- modified at 12:10 Thursday 9th March, 2006
|
|
|
|
|
chaitanya22 wrote: How could i append the length of x2 bytes to x1, so that i should have total 212 bytes.
Use memcpy() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
if(count>0)
memcpy(array,buffer, 213);
for(int i=0;i<=length;i++)
printf("%x", array[i]);
if i do so, again its copying with chunks in between the data.
as i should copy the buffer of count:2 to buffer of count:1, so am using
array[i+lLength]=lData[i]; //from starting of next chunk
for(int i=0;i<=length;i++)
{printf("%x", array[i]);}
is this correct???
|
|
|
|
|
Consider:
char arr1[12] = "Hello ";
char arr2[6] = "World";
memcpy(&arr1[6], arr2, 5 * sizeof(char));
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Yes, Tahnk you for your answer. I got the solution.
|
|
|
|
|
Hi everybody!
I have to translate in italian a simple application called TLX (task load index) edited by NASA in the 70's (I think).
Does anybody knows if is it possible to find source codes of existent tlx applications? and if it's possible, where can I find them?
I only have the exe file in english. I think I'll have to use MFC.
if anybody knows something about tlx please reply to this post!! I need heeeeeeeeeeelp.
ok. stop. thanks. kisses.
sorry for my bad english
jude
|
|
|
|
|
Hi,
did someone use the DrivePackageInstall? I used the follow code to test but this give to me two error messages( "can't open or write in the file"or "the syntax of file name, folder or volume is wrong" )
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
char *pathInfFile = "C:\\driver\\mdmazlw.inf";
BOOL needReboot = FALSE;
DWORD driverInstalled;
driverInstalled = DriverPackageInstall(pathInfFile,
DRIVER_PACKAGE_SILENT,
NULL, &needReboot );
if(driverInstalled == ERROR_ACCESS_DENIED)
MessageBox(NULL,"problem","Test",MB_OK);
if(needReboot)
MessageBox(NULL,"Reinicie o computador para completar a instalação","Teste",MB_OK);
else
MessageBox(NULL,"Instalação efetuada com sucesso","Teste",MB_OK);
return 0;
}
I need help!!!
Gratefull,
Hélio
|
|
|
|
|
I am a bit new at C++. I am trying to important various functions from a .dll file. I have both the .dll and the .lib files, and I know the function definition because they were previously imported in a Visual Basic project. How can I use the functions? For example, say I have the files x.dll and x.lib, which contain a function int z(int). What do I need to do use that function? The only method I found was using the __declspec(dllimport) int z(int);, and I am not even sure if that is correct since it gave me linking errors.
Thanks in advance for your help.
Kiernan
|
|
|
|
|
kialmur wrote: ...I am not even sure if that is correct since it gave me linking errors.
Did you link with x.lib?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I am not quite sure how. I tried adding it to the project and also added it in one of project settings under Linking. Is there some otherway?
|
|
|
|
|
kialmur wrote: Is there some otherway?
There is, but if you are already adding it to the linker options, it's pointless.
Exactly what linker error(s) are you getting?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
The error is:
error LNK2001: unresolved external symbol "long __cdecl sendChipOffset(long,long,long)" (?sendChipOffset@@YAJJJJ@Z)
For the linking portion, I went in the project settings, then to the Link tab. I added the path under Object/library modules. Is that correct?
|
|
|
|
|
kialmur wrote: The error is:
error LNK2001: unresolved external symbol "long __cdecl sendChipOffset(long,long,long)" (?sendChipOffset@@YAJJJJ@Z)
This is a name-mangling issue.
kialmur wrote: Is that correct?
Yes.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I have a window that needs to display text using a fixed size (mono spaced) TT font (say Courier New) and the text will be limited to 80 columns by 24 rows. I need to calculate the bounding rect that keeps the aspect ratio of the font and centers it in the window.
I can get all this to work fine.
The next problem is choosing the font size. How do I get windows to give me a font size that will correctly fill this rect? Is this not possible? It seems no matter what I do, I get font sizes that do not scale up or down smoothly, and the text is usually either too small or too big.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
The MidiPlyr PSDK sample has code which scales the timer text so it fills the window (not very well mind you). It's located in Samples/Multimedia/Audio/MidiPlyr/uiutils.c:EmbossedTextOut() and CreateScaledFont(). 80% chance that the scaled font feature (and all of uiutils.c) was created as an extra credit assignment.
But anyway, the API to use is GetTextExtentPoint32.
-- modified at 11:43 Thursday 9th March, 2006
|
|
|
|
|
Thanks. I know about GetTextExtentPoint32. Unfortunately the problem is getting windows to use a reasonable font size. It appears that windows only has a few font sizes, and there's no provision or way to smoothly scale up or down without jumps in sizes. This means that sometimes the font matches the rect just fine, others it's too small, and other times it's too big. I'll look into the example though!
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|