Thread: WinApi Help Needed

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    8

    WinApi Help Needed

    i am new to winapi and i am a little bit stuck if i have a dos based code like this :

    Code:
     
    main ()
    {
    char examp[20];
    scanf("%s",examp);
    printf("%s",examp);
    }
    how can i transfer scanf and printf to winapi,i know that i should you a editbox,but how?

    thanks
    Last edited by spanker; 01-02-2008 at 11:46 AM.

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Not to be rude, but I don't think you're ready for Windows programming.
    And read this, concerning scanf: http://cboard.cprogramming.com/showp...37&postcount=9
    Also learn to indent:
    Code:
    int main ()
    {
    	char examp[20];
    	scanf(%s",examp);
    	printf("%s",examp);
    }
    And main should explicitly return int.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Also, there is a specific board for Windows Programming questions: http://cboard.cprogramming.com/forumdisplay.php?f=7

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    That's right, so this thread has been moved.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Quote Originally Posted by spanker View Post
    how can i transfer scanf and printf to winapi,i know that i should you a editbox,but how?

    Those three lines become about two pages of WIN32 code!
    You need a message pump, callback, event handlers and winmain not a main.

    I suggest you read some tutes, search here for some links (ie http://winapi.foosyerdoos.org.uk/ by Ken Fitlike one of the mods.)

    WIN32 is not too hard, but a bit of a leap (in logic) from 'structured' applications (happens in a set sequence) to 'event driven' apps (responds as required to user/system events).

    Start simple, try a 'hello world' app first and work your way up.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with ZwQueryDirectoryFile for my Driver.
    By taDo in forum Windows Programming
    Replies: 9
    Last Post: 11-27-2008, 08:54 AM
  2. WinAPI & threading
    By @nthony in forum Windows Programming
    Replies: 17
    Last Post: 10-15-2007, 04:41 PM
  3. do i still need winAPI
    By datainjector in forum Windows Programming
    Replies: 8
    Last Post: 07-12-2003, 01:43 AM
  4. references for the winapi
    By stallion in forum Windows Programming
    Replies: 9
    Last Post: 01-28-2003, 02:56 AM
  5. WINAPI: Meaning of HDC ?
    By Mecnels in forum Windows Programming
    Replies: 1
    Last Post: 01-21-2002, 10:06 AM