|
Hi,
What if I use SetForegroundWindow(hCalWin);
DWORD AllowSetForegroundWindow(procId);
OR
AnyPopup();
When I execute and type in the file name on command window, it starts doing calibration returning the cursor to next line, that means it is't able to detect it.
You said there are other methods for it. Let me know. Please help.
Thanks
Preeti9
|
|
|
|
|
AnyPopup is an archaic function. I don't see at the moment how SetForegroundWindow, etc. would help you.
I need more information about what the calibration process is doing. What is the result from the following code:
pTouch->Recalibrate();
HWND hRecalWnd = FindWindow(...);
DWORD RecalProcID = 0;
DWORD RecalThreadID = GetWindowThreadProcessId( hRecalWnd, &RecalProcID );
char MsgText[1024];
DWORD CurProcID = GetCurrentProcessId();
DWORD CurThreadID = GetCurrentThreadId();
sprintf( MsgText, "HWND = %p\nValid = %s\nRecalProcID = %x\nRecalThreadID = %x\nCurProcID = %x\nCurThreadID = %x",
hRecalWnd, IsWindow(hRecalWnd) ? "Yes" : "No",
RecalProcID, RecalThreadID, CurProcID, CurThreadID );
MessageBox( NULL, MsgText, "Test", MB_OK );
|
|
|
|
|
The code is doing calibration and doesn't shows anything. Its running the same way as earlier code was running.
Should I send you all the files again?
Thanks
Preeti
Preeti9
|
|
|
|
|
hi,
i am creating a FTP application in which i have used a progress bar for showing the status of the download. for doing this i used the CFtpConnection::OpenFile() method so that i will read the data in small number of bytes and then display the status. the problem here is that when i try to open the file using this method the return value which should be in the form of a CInternetFile is being returned as a null value. hence i am not able to read the file and there is an excepetion
the syntax i have used is as follows:
the completePath is a CString and contains the path as ftp://homepc/test.txt
i have used IIS to create a ftp site and stored some text files as well as other file in the ftp root directory
try
{
srcFile = pftp->OpenFile(completePath, GENERIC_READ,
INTERNET_FLAG_TRANSFER_BINARY, 1);
}
catch(CInternetException *IE)
{
display the exception
}
when i debugged the program i found out that the srcFile had nothing in it i.e it was NULL with some "?????" in the watch window. can anyone tell me why am i getting this problem or is there any other way to use the progress bar?
aditya
|
|
|
|
|
Do you have an alias for homepc set to 127.0.0.1 on your development machine? Have you checked the permissions of the file on the FTP server? Have you checked that the FTP server allows anonymous access (assuming you are not using a username and password) ?
HTH.
|
|
|
|
|
Hi,
I want to know is there any direct method in C to remove all the spaces in a string.
Thanks.
|
|
|
|
|
Sure. Several ways exist. One way looks like:
char str[] = "This string has spaces";
int x, y;
for (x = 0, y = 0; str[x] != '\0'; x++)
{
if (' ' != str[x])
{
str[y] = str[x];
y++;
}
}
str[y] = '\0';
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Surely:
str[y++] = str[x];
is a bit more efficient
|
|
|
|
|
Anonymous wrote:
str[y++] = str[x];
is a bit more efficient
Are you sure? It may be in theory, but in practice, the compiler will most likely optimize both versions of the source code into exactly the same object code.
I made a simple test with the following code:
#pragma auto_inline(off)
void Test(int x, int y, char* str)
{
str[y] = str[x];
y++;
}
void Test2(int x, int y, char* str)
{
str[y++] = str[x];
}
I wrote each of these functions in separate source files, and called each of them from a function in a third file.
In a Release build, with the default optimizations, the compiler not only detected they were the same thing, but in fact removed Test2 entirely, and changed the call to it, making it call Test instead.
This was the dissambly for Test()
void Test(int x, int y, char* str)
{
str[y] = str[x];
004016C0 mov eax,dword ptr [esp+0Ch]
004016C4 mov ecx,dword ptr [esp+4]
004016C8 mov dl,byte ptr [ecx+eax]
004016CB mov ecx,dword ptr [esp+8]
004016CF mov byte ptr [ecx+eax],dl
y++;
}
004016D2 ret
[Update]
After submitting this post I realized that I should have make the y parameter a reference:
void Test(int x, int& y, char* str)
{
str[y] = str[x];
y++;
}
In the previous version, it didn't make sense to increment y , because that increment won't be seen outside of the function. Of course, the compiler spotted this and didn't even bothered to generate code for it.
After the modifications, the results were exactly the same: Test2 was not generated, and Test was called instead. The only change was the generated code for Test
void Test(int x, int& y, char* str)
{
str[y] = str[x];
004016D0 mov eax,dword ptr [esp+8]
004016D4 mov ecx,dword ptr [esp+0Ch]
004016D8 mov edx,dword ptr [eax]
004016DA push ebx
004016DB push esi
004016DC mov esi,dword ptr [esp+0Ch]
004016E0 mov bl,byte ptr [esi+ecx]
004016E3 mov byte ptr [ecx+edx],bl
y++;
004016E6 add dword ptr [eax],1
004016E9 pop esi
004016EA pop ebx
}
004016EB ret
[End of Update]
In general, focusing on optimizing that kind of details in the source code is a waste of time, and in some cases it may even penalize code clarity for no real benefit.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
My point was for clarity, not efficiency.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
|
It must have worked okay, cause all the spaces are gone.
Chris Meech
I am Canadian. [heard in a local bar]
Remember that in Texas, Gun Control is hitting what you aim at. [Richard Stringer]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
Looks like MS isn't going to update this anymore. What are the other available options?
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
This may help [^]
onwards and upwards...
|
|
|
|
|
if i add a string to combobox, like
m_combo.AddString("text");
its throwing "Assertion Failed" error.. y?
regards,
Rookie
|
|
|
|
|
Where are you adding this row? If it's in a dialog it has to be not before OnInitDialog.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
I mainly use mc++ but can use standard c++ if needed. I am simply trying to get a consol to open and then open the cmd.exe process withing the consol window. I can only seem to open the consols in separate windows. I just need to send a string to the cmd.exe and have it execute the string and the prompt. Any suggestions? I have done multipal searches but they havent really helped. Thanks in advance.
|
|
|
|
|
Lagwagon56 wrote:
I just need to send a string to the cmd.exe and have it execute the string and the prompt.
What are you trying to do at the command prompt? Perhaps there is a better way.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
You could do like this:
1. Create a console which you attach to the process using AttachConsole[^]
2. Run the commandline by passing it to CreateProcess[^] and give it your stdout handle which you can obtain from the GetStdHandle(STD_OUTPUT_HANDLE) function.
That should execute the commandline and output its output to the console window you created... But it wont give you a promt!
I hope I've given you some ideas...
"There is an empty room full of people who think you are creative"
|
|
|
|
|
Thanks for the suggestion. I'll give it a go. Looks like it will work well. Thanks. A friend of mine wants to play an old dos game that he just found in an old pile of software. It will not run correctly under XP. I located a file that fixes it but it needs to be loaded via cmd prompt and then the game must be launched via cmd prompt. It's easy to do manualy i just wanted to make a single exe that he could click and launch everything needed to run the game.
|
|
|
|
|
Ehm,...
Have you tried using a .bat file?
Or a regular shortcut?
"There is an empty room full of people who think you are creative"
|
|
|
|
|
Regular shortcut does not seem to work. Didn't try at .bat file. I am unfamiliar with .bat. Could you point me to a good resource? Thnaks
|
|
|
|
|
It's just a file which contains a number of commandlines that will be exeuted...
Try writing in notepad e.g.:
dir
pause
and save it to a file ending with .bat...
"There is an empty room full of people who think you are creative"
|
|
|
|
|
.bat did the trick, Thanks!
|
|
|
|
|
Hi,
I have created one class for thread and another class for HTTP client request and response both GET and POST methods. I have created 5 objects for thread and made the 5 client request for different web sites and I want to update response to text boxes or variables. I used SDK APIs (CreateThread). How do update the worker thread result to User interface controls.
Which is the best methods for multithreading mutiple client request?
Quote your thoughts...
Regards,
inba.
|
|
|
|