TheBeast32 54 Posting Whiz in Training

That's weird, because if you type help, you will get the help message.

TheBeast32 54 Posting Whiz in Training

Hi, how would I make a program that gets input from a user, sends it to a program with popen(), gets the output, and repeats this until the program ends? I have tried, but I only get part of the output, and when I type "exit", it won't end the program.

#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <string>
#include <sstream>
#include <iostream>
using namespace std;

int main()
{
   
FILE *fp = popen("cmd.exe", "r+" );
char buff[50];
char command[50];

while (fp != NULL)
{
while ( fgets( buff, sizeof buff, fp ) != NULL ) 
{
  cout << buff;
}
cin.getline(command, sizeof command);
fputs(command, fp);
}
pclose( fp );

getch();  
   
}

From this, I only get "Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp." when it starts, while I should also be getting the "C:\documents and settings\...." after it.

TheBeast32 54 Posting Whiz in Training

Thanks salem it worked

TheBeast32 54 Posting Whiz in Training

How could I "fork a new process and run the program in that new process and pipe or redirect the output of the child process as an input to the parent process"?

TheBeast32 54 Posting Whiz in Training

Hi, I need to get the output of a program called with the system() function. How would I do this?

TheBeast32 54 Posting Whiz in Training

Yes! It works! Thank you.

TheBeast32 54 Posting Whiz in Training

That's weird. It works for me. I'll try doing what you said.

TheBeast32 54 Posting Whiz in Training

It's not program1.exe, I made a mistake. It's project1.exe.

TheBeast32 54 Posting Whiz in Training

It can compile the input box dialog here: http://www.codeproject.com/KB/dialog/w32inputbox_1.aspx. That uses resources, so I don't think that's the problem. If you don't have a code project account, I have attached the files. The dev-c++ compiled file is program1.exe.

TheBeast32 54 Posting Whiz in Training

Hi, I have been trying to make a dialog, but I keep getting an error. I'm using Dev-C++ 4.9.9.2, and I get this error "[Resource error] syntax error". Here's my code for the dialog:

IDD_CONNECT DIALOG DISCARDABLE 0, 0, 300, 250
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Connect"
FONT 8, "MS Sans Serif"
BEGIN
    DEFPUSHBUTTON   "Connect",IDOK,174,18,50,14
    PUSHBUTTON      "Cancel",IDCANCEL,174,35,50,14
    GROUPBOX        "Connect Information...",IDC_STATIC,7,7,225,52
    CTEXT           "Enter the host/IP to connect to and click connect",
                    IDC_STATIC,16,18,144,33
END
TheBeast32 54 Posting Whiz in Training

Thanks. I thought it was that, but I wasn't sure. Also, I like <conio.h>.

TheBeast32 54 Posting Whiz in Training

Hi, I have been making a program that encrypts files. It works, but it compresses them. It only does it a little bit, but it does. It's weird. Why is it doing this?
I have attached a zipped folder with the code, binary, an encrypted file, and the original file. The key to decrypt the file is "hello" without quotes. Once you decrypt the included file, you'll see that they are now the same size.

TheBeast32 54 Posting Whiz in Training

A good book that I have recently bought is Programming Windows Fifth Edition by Charles Petzold. It talks about using the Win32 API. It also has code examples and an accompanying CD. It's like $60, but I got mine used for $30 on www.amazon.com.

TheBeast32 54 Posting Whiz in Training

I figured it out, you have to include #include <commctrl.h>, link with the comctl32 library, and put InitCommonControls() in your WM_CREATE message handler. Then you can get on a command line and edit your program with the one I mentioned above (http://www.codeproject.com/KB/cpp/AddXpStyle.aspx).

TheBeast32 54 Posting Whiz in Training

HI, I have been wondering how to make a program with the XP style buttons, edit boxes, etc. in it. I have made a GUI, but it's ugly. How can I make the controls look like the ones on say, a windows property sheet or something like that? I have tried the tutorial on http://www.codeproject.com/KB/cpp/AddXpStyle.aspx, but it ERASED ALL OF MY CONTROLS.

TheBeast32 54 Posting Whiz in Training

If you're lazy and on windows:

system("shutdown -r");
TheBeast32 54 Posting Whiz in Training

Thanks, I just wanted to make sure I wasn't learning something that I couldn't use.

TheBeast32 54 Posting Whiz in Training

Thanks!

TheBeast32 54 Posting Whiz in Training

Never mind about the CD files. I got them.

TheBeast32 54 Posting Whiz in Training

Hi, I have bought Programming Windows Fifth Edition by Charles Petzold. I was wondering if there are any differences between the Win32 API talked about in this book and the one that applies to Vista or anything newer than Windows 2000. Also, my book didn't come with the CD (I got it used), so could someone post a link or attach the files from it?

TheBeast32 54 Posting Whiz in Training

Thanks.

TheBeast32 54 Posting Whiz in Training

Hi, I have been making a macro building program. I am trying to handle mouse events right now. I have made a program that hooks the mouse, then puts information into a text file which is then read by another program. The recorder writes the delay in milliseconds, so the events don't just happen at one time. It then writes the type of the event. Then it writes the other information like X and Y, right mouse button, wheel, intensity, etc. . I have no idea if this is a good way to do this or not, or how to read the file so I can simulate mouse events. Please help.:icon_neutral:

The code is attached. I'm using Dev-C++ 4.9.9.2.
Here is some output from the program that records the mouse:

1922 MMOVE 530 437
1938 MMOVE 529 437
3078 MWHEEL 120
7422 MDOWN R
7594 MUP R
11031 MMOVE 529 436
11094 MMOVE 529 435
11172 MMOVE 529 435
11188 MMOVE 529 434
11250 MMOVE 529 434
11860 MMOVE 528 434
11875 MMOVE 528 434
11953 MMOVE 527 434
12547 MDOWN L
12625 MUP L
TheBeast32 54 Posting Whiz in Training

Thanks for the tips!

TheBeast32 54 Posting Whiz in Training

Hi, I'm making a website. I want it to look professional. I don't want to use templates because I think of that as cheating. I want to be able to make one myself. Whenever I make a web page, it doesn't look very good. If anyone has any tips. Please tell me.:icon_question:

TheBeast32 54 Posting Whiz in Training

Nevermind, i got it! I had an old libmysql.dll in my C:\windows\system32 directory. I deleted it and it worked perfectly.

TheBeast32 54 Posting Whiz in Training

Hi, I have been trying to get MySQL to work on my apache server with PHP on it. My Apache
version is 1.3.29 and my PHP version is 5.0.0RC2. I'm also running Windows XP Professional SP2 32 bit. I tried modifying the php.ini file to load the php_mysql.dll, but I keep getting an error whenever I restart Apache. My Apache directory is C:\Program Files\Apache Group\Apache\, and my PHP directory is C:\Program Files\Apache Group\Apache\PHP\. The directory with the dynamic link libraries (dlls) in it is C:\Program Files\Apache Group\Apache\PHP\ext\. The error pops up three times, and then Apache starts, and I can view my server with IE 7.

I have attached my php.ini from my %SYSTEMROOT% directory as well as a picture of the error.

Please help!:-/

TheBeast32 54 Posting Whiz in Training

Check out www.cplusplus.com. It's filled with information about file IO, strings, user input, and lots more. You might not want to make a GUI if you are very new to C++ and OOP.

TheBeast32 54 Posting Whiz in Training

I'm using the GMP library which works great.

TheBeast32 54 Posting Whiz in Training

Thanks for your help! Also, marco93, It's only 1 picture, i'm not going to take 5000. And, it works so i'm happy. =)

TheBeast32 54 Posting Whiz in Training

I started out with visual basic, so a GUI game of rock paper scissors would probably be out of the question. When I started C++, it took me a long time to get the hang of it. One of the first things I made was a prime number generator. You could probably search forums and see a thread that I started about it. That was a long time after I started though. I just wanted to make it faster. You will definitely need the internet. A LOT. If you start trying to make GUIs using the win32 API (not visual C++), there is a lot of complicated code involved. The internet is like the best resource. Once you get going, it will get a lot easier and you will understand it more.

TheBeast32 54 Posting Whiz in Training

Hi, this works for notepad, so i think it'll work for msn. Modify it a little and try it.

#include <windows.h>
int main()
{

char buffer[MAX_PATH];
char *message = "hello";
sprintf(buffer, "%s", message); 

//GetWindowText(hwContact, szContact, 256);
//strcpy(&szContact[strlen(szContact)], " - Conversation");

//GetWindowText(hwMsg, szMsg, 256);
//strcpy(&szMsg[strlen(szMsg)], "");
				
HWND fcContact = FindWindow(NULL, "Untitled - Notepad");

ShowWindow(fcContact, SW_SHOWMAXIMIZED);
SetForegroundWindow(fcContact);
//FindWindowEx( hTray, NULL, "Button", NULL);
SendMessage(FindWindowEx(fcContact, NULL, "Edit", NULL), WM_SETTEXT, 0, (LPARAM)buffer);

return 0;
}
TheBeast32 54 Posting Whiz in Training

Hi, I am making a simple screen shot program. I need to be able to capture the entire screen, or if possible, a region of the screen (like a rectangle from point (25, 60) to (300, 456)). I also need to be able to save it to a bitmap file. I read a tutorial, but it only said how to save black and white bitmaps. I need them to be in color.

TheBeast32 54 Posting Whiz in Training

Not really. I tried more than once, why would it fail every time?

TheBeast32 54 Posting Whiz in Training

Hi, i have made a simple program that gets all of the running processes on a computer and gets the text from their windows. It works, but sometimes it gives the wrong text. For example, i have notepad open, and it doesn't say the right text. To compile, you have to link it with the psapi library.

#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <psapi.h>
#include <conio.h>
#include <iostream>
using namespace std;

int main()
{
SetConsoleTitle("Process list");
DWORD ProcessesIDs[50], cbNeeded, cProcesses;
unsigned int i;

TCHAR szProcessName[50] = TEXT("<unknown>");

if (!EnumProcesses( ProcessesIDs, sizeof(ProcessesIDs), &cbNeeded ))
return 0;

cProcesses = cbNeeded / sizeof(DWORD);

for ( i = 0; i < cProcesses; i++ )
{
HANDLE hProcess = 
OpenProcess( PROCESS_QUERY_INFORMATION | 
PROCESS_VM_READ, FALSE, ProcessesIDs[i] );
    
if (NULL != hProcess )
{
GetModuleBaseName( hProcess, NULL, 
szProcessName, sizeof(szProcessName)/sizeof(TCHAR) );
}
    
HWND h = GetTopWindow(0 );
char WindowText[256];

while (h)
{
DWORD pid;
DWORD dwTheardId = GetWindowThreadProcessId( h,&pid);

if (pid == ProcessesIDs[i])
{
GetWindowTextA(h, WindowText, 256);
              break;
}

h = GetNextWindow(h , GW_HWNDNEXT);
}
     
_tprintf(TEXT("Process name: %s, PID: %u \n"), 
szProcessName, ProcessesIDs[i]);
_tprintf(TEXT("Window Text: %s\n\n"), WindowText);
    
CloseHandle(hProcess);
    
}

getch();
}

Here's the output:


Process name: <unknown>, PID: 0
Window Text:

Process name: Æ’unknown>, PID: 4
Window Text:

Process name: smss.exe, PID: 464
Window Text:

Process name: smss.exe, PID: 532
Window Text:

Process name: winlogon.exe, PID: 556
Window Text:

Process name: services.exe, PID: 600
Window Text:

Process name: lsass.exe, PID: 612

TheBeast32 54 Posting Whiz in Training

Hi, I recently watched the movie Iron Man. While making his first suit, Tony Stark apparently is using C++ on the laptop in the background. Is this C++ and if not what is it?

TheBeast32 54 Posting Whiz in Training

It needs to be able to hold about one quintillion.

TheBeast32 54 Posting Whiz in Training

Hi, is there a data type larger than unsigned long long int except double? I don't want double or float because I need to keep it as precise as possible. I also need it to be able to do modulus. How would I do this?

TheBeast32 54 Posting Whiz in Training

Thanks for your help!

TheBeast32 54 Posting Whiz in Training

ZOKOR, I'm all set on putting safedisc on my computer:
1. I don't have a DVD burner.
2. I hate putting disks back in all the time to run programs. Look at this: http://en.wikipedia.org/wiki/SafeDisc#Operation

TheBeast32 54 Posting Whiz in Training

Thanks caperjack. I installed Cute CD DVD Burner before you posted a reply, and it said that I can only read DVDs.
Will an Apple iBook G4 be able to write to DVDs and if so burn an ISO image to them?

TheBeast32 54 Posting Whiz in Training

That's most likely the case. Ill attach a picture of my drive. Is there a way I can burn a DVD without buying a new one?

TheBeast32 54 Posting Whiz in Training

Yes, i can burn pictures, music, and ISO images to a CD-R disk.

TheBeast32 54 Posting Whiz in Training

IsoBuster didn't work. It just said "No media present". I updated my IDE ATA/ATAPI Controller: SiS 5513 IDE UDMA Controller. That didn't work. My AOPEN COM5232/AAH PRO firmware is up to date (R.1.08). I have no idea what to do.........

TheBeast32 54 Posting Whiz in Training

I have 2 different DVD brands that bothwon't work: Sony DVD+RW, and Maxell DVD-R.
I will try the isobuster and see if it works.

TheBeast32 54 Posting Whiz in Training

I have tried to do it on 2 other computers. It still won't work, so I don't think it's the burner.

TheBeast32 54 Posting Whiz in Training

No, windows explorer and every other program I use, including ISO Recorder, says that there's no disk in. Which program should I use? I have MagicISO. I can't get nero because I have dial-up, so that would take forever. I checked my drive firmware. It's completely up to date. Also, another detail I left out: whenever I put the disk in, Windows slows down a lot.

TheBeast32 54 Posting Whiz in Training

I'm using ISORecorderV2RC1

TheBeast32 54 Posting Whiz in Training

Hi, whenever I put a blank DVD-R or RW disk into my drive, Windows will say it's not there. The cursor turns into a little CD, but whenever I try to burn an ISO image or any type of file onto it, it says that it's not in. I looked on microsoft.com, and it said to get a hotfix for udfs.sys. Would this help me?

I am using:

Operating System:
Windows XP Professional SP2

DVD/CD-ROM Drive:
AOPEN COM5232/AAH PRO

TheBeast32 54 Posting Whiz in Training

I have done FTP before and it didn't block it. That's the only time I've seen it try to block it.

TheBeast32 54 Posting Whiz in Training

I was doing a simple ftp and look what I found! Look at the attachment!