This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Develop for Windows 2.0 using eMbedded 3.0?


Develop for Windows 2.0 using eMbedded 3.0?

Postby Daywalker » Jun 26, 2001 @ 5:58pm

I want to write games for my HPC (SH3) with Windows CE 2.0. Now ive downloaded eMbedded 3.0 and i want to know how to tell eMbedded 3.0 to use the HPC 2.0 SDK.
User avatar
Daywalker
pm Member
 
Posts: 15
Joined: Jun 26, 2001 @ 5:58pm


Re: Develop for Windows 2.0 using eMbedded 3.0?

Postby Moose or Chuck » Jun 26, 2001 @ 6:13pm

When you press New to start a new project highlight "WCE Application," not "WCE Pocket PC Application." And make sure you select the processor types you're developing for in the bottom right.
Moose or Chuck
 


Re: Develop for Windows 2.0 using eMbedded 3.0?

Postby jongjungbu » Jun 26, 2001 @ 7:26pm

Be sure to watch out for functions that have different arguments for 2.0 vs. 3.0. Especially when using MFC, but there are plenty of cases running around. For instance, the Random() function..you need to include the header Winuser.h in CE 3.0. For CE 1.0 or above you would include the header Winbase.h.<br><br>Of course, if yer looking at the documentation for the HPC SDK & CE 2.0, then you won't have to worry I suppose.<br><br>
User avatar
jongjungbu
Not JongJongBu
 
Posts: 3112
Joined: Jun 19, 2001 @ 4:22am
Location: USA


Re: Develop for Windows 2.0 using eMbedded 3.0?

Postby Daywalker » Jun 27, 2001 @ 3:34am

My Application run on the HPC as long as im not including any sourcecode in the WinMain() rountine. If im trying to start the Hello World example, i get a fatal application error. Is it possible that it happens because the arguments of the Hello World example are made for CE 3.0?
User avatar
Daywalker
pm Member
 
Posts: 15
Joined: Jun 26, 2001 @ 5:58pm


Re: Develop for Windows 2.0 using eMbedded 3.0?

Postby jongjungbu » Jun 27, 2001 @ 3:43am

Hello World is a pretty simple application. I think pretty much all of the functions in it are identical for CE 1.0 and up. Are you sure you are compiling for the right CPU (device)?
User avatar
jongjungbu
Not JongJongBu
 
Posts: 3112
Joined: Jun 19, 2001 @ 4:22am
Location: USA


Re: Develop for Windows 2.0 using eMbedded 3.0?

Postby Dan East » Jun 27, 2001 @ 8:10am

Could you post the source?<br><br>Dan East
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Re: Develop for Windows 2.0 using eMbedded 3.0?

Postby Daywalker » Jun 27, 2001 @ 9:15am

The source? I click on File->New->WCE Application (processor SH3)->A Typical Hello World Application. Use SH3 Debug or Release, compile and copy the .exe to the HPC. <br>--------------------------------------------------<br>The funny thing is that it doesnt crash as long as im not implementing any Windows stuff:<br><br><br>#include "stdafx.h"<br>int WINAPI WinMain(      HINSTANCE hInstance,<br>                        HINSTANCE hPrevInstance,<br>                              LPTSTR    lpCmdLine,<br>                              int       nCmdShow)<br>{<br>       // TODO: Place code here.<br><br>      for (int t=0; t<20000; t++)  {}<br><br><br>      return 0;<br>}<br><br><br>It doesnt crash, but i dont get any feedback :(.Last modification: Florian Brede - 06/27/01 at 06:15:43
User avatar
Daywalker
pm Member
 
Posts: 15
Joined: Jun 26, 2001 @ 5:58pm


Re: Develop for Windows 2.0 using eMbedded 3.0?

Postby Dan East » Jun 27, 2001 @ 9:44am

Right, what you have won't do anything. In WinMain you have to create your window, etc. The Hello World framework should create a function InitInstance, which is called from WinMain. In InitInstance the window is created. Does it work if you create a new Hello World app, and build it without modifying it?<br><br>Try hitting F5 to begin debugging on your device (with a Debug build of course). It will be very slow if you only have a serial connection, but it should show you exactly where it fails.<br><br>Also, leave all the default Processor Type boxes checked when you create a new project. Otherwise you will have to do extra work down the road if you want to build for the other types of processors.<br><br>Dan East
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Re: Develop for Windows 2.0 using eMbedded 3.0?

Postby Daywalker » Jun 27, 2001 @ 12:05pm

Sorry, i cant debug, eMb 3.0 cant detect my connection.<br>I didnt modify the "Hello World" code.<br>Should programming for a HPC with wince 2.0 using HPC PRO 2.11 SDK normally work?
User avatar
Daywalker
pm Member
 
Posts: 15
Joined: Jun 26, 2001 @ 5:58pm


Re: Develop for Windows 2.0 using eMbedded 3.0?

Postby jongjungbu » Jun 27, 2001 @ 1:26pm

That is a really odd loop to be in the WinMain() function. And you say you didn't modify the Hello World at all?<br>You know, what it looks like to me is you chose "A simple Windows CE application" among a choice of "An empty project" and "A typical "Hello World!" application".<br><br>If what you  posted is the complete source for your application, then I'm pretty sure that was the option for "A Simple Windows CE application".<br>You could be doing everything right, and I'm wrong..but on my eMbedded 3.0...those are the options. and that is the result.<br><br>
User avatar
jongjungbu
Not JongJongBu
 
Posts: 3112
Joined: Jun 19, 2001 @ 4:22am
Location: USA


Re: Develop for Windows 2.0 using eMbedded 3.0?

Postby Daywalker » Jun 27, 2001 @ 1:33pm

No, what i posted wasnt the Hello World example.<br>The main sourcecode of the hello worls example is this:<br><br><br>// sdf.cpp : Defines the entry point for the application.<br>//<br><br>#include "stdafx.h"<br>#include "sdf.h"<br>#include <commctrl.h><br><br>#define MAX_LOADSTRING 100<br><br>// Global Variables:<br>HINSTANCE                  hInst;                  // The current instance<br>HWND                        hwndCB;                  // The command bar handle<br><br>// Forward declarations of functions included in this code module:<br>ATOM                        MyRegisterClass      (HINSTANCE, LPTSTR);<br>BOOL                        InitInstance      (HINSTANCE, int);<br>LRESULT CALLBACK      WndProc                  (HWND, UINT, WPARAM, LPARAM);<br>LRESULT CALLBACK      About                  (HWND, UINT, WPARAM, LPARAM);<br><br>int WINAPI WinMain(      HINSTANCE hInstance,<br>                              HINSTANCE hPrevInstance,<br>                              LPTSTR    lpCmdLine,<br>                              int       nCmdShow)<br>{<br>      MSG msg;<br>      HACCEL hAccelTable;<br><br>      // Perform application initialization:<br>      if (!InitInstance (hInstance, nCmdShow)) <br>      {<br>            return FALSE;<br>      }<br><br>      hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_SDF);<br><br>      // Main message loop:<br>      while (GetMessage(&msg, NULL, 0, 0)) <br>      {<br>            if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) <br>            {<br>                  TranslateMessage(&msg);<br>                  DispatchMessage(&msg);<br>            }<br>      }<br><br>      return msg.wParam;<br>}<br><br>//<br>//  FUNCTION: MyRegisterClass()<br>//<br>//  PURPOSE: Registers the window class.<br>//<br>//  COMMENTS:<br>//<br>//    It is important to call this function so that the application <br>//    will get 'well formed' small icons associated with it.<br>//<br>ATOM MyRegisterClass(HINSTANCE hInstance, LPTSTR szWindowClass)<br>{<br>      WNDCLASS      wc;<br><br>    wc.style                  = CS_HREDRAW | CS_VREDRAW;<br>    wc.lpfnWndProc            = (WNDPROC) WndProc;<br>    wc.cbClsExtra            = 0;<br>    wc.cbWndExtra            = 0;<br>    wc.hInstance            = hInstance;<br>    wc.hIcon                  = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SDF));<br>    wc.hCursor                  = 0;<br>    wc.hbrBackground      = (HBRUSH) GetStockObject(WHITE_BRUSH);<br>    wc.lpszMenuName            = 0;<br>    wc.lpszClassName      = szWindowClass;<br><br>      return RegisterClass(&wc);<br>}<br><br>//<br>//  FUNCTION: InitInstance(HANDLE, int)<br>//<br>//  PURPOSE: Saves instance handle and creates main window<br>//<br>//  COMMENTS:<br>//<br>//    In this function, we save the instance handle in a global variable and<br>//    create and display the main program window.<br>//<br>BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)<br>{<br>      HWND      hWnd;<br>      TCHAR      szTitle[MAX_LOADSTRING];                  // The title bar text<br>      TCHAR      szWindowClass[MAX_LOADSTRING];            // The window class name<br><br>      hInst = hInstance;            // Store instance handle in our global variable<br>      // Initialize global strings<br>      LoadString(hInstance, IDC_SDF, szWindowClass, MAX_LOADSTRING);<br>      MyRegisterClass(hInstance, szWindowClass);<br><br>      LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);<br>      hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,<br>            CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);<br><br>      if (!hWnd)<br>      {      <br>            return FALSE;<br>      }<br><br>      ShowWindow(hWnd, nCmdShow);<br>      UpdateWindow(hWnd);<br>      if (hwndCB)<br>            CommandBar_Show(hwndCB, TRUE);<br><br>      return TRUE;<br>}<br><br>//<br>//  FUNCTION: WndProc(HWND, unsigned, WORD, LONG)<br>//<br>//  PURPOSE:  Processes messages for the main window.<br>//<br>//  WM_COMMAND      - process the application menu<br>//  WM_PAINT      - Paint the main window<br>//  WM_DESTROY      - post a quit message and return<br>//<br>//<br>LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)<br>{<br>      HDC hdc;<br>      int wmId, wmEvent;<br>      PAINTSTRUCT ps;<br>      TCHAR szHello[MAX_LOADSTRING];<br><br>      switch (message) <br>      {<br>            case WM_COMMAND:<br>                  wmId    = LOWORD(wParam); <br>                  wmEvent = HIWORD(wParam); <br>                  // Parse the menu selections:<br>                  switch (wmId)<br>                  {<br>                        case IDM_HELP_ABOUT:<br>                           DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);<br>                           break;<br>                        case IDM_FILE_EXIT:<br>                           DestroyWindow(hWnd);<br>                           break;<br>                        default:<br>                           return DefWindowProc(hWnd, message, wParam, lParam);<br>                  }<br>                  break;<br>            case WM_CREATE:<br>                  hwndCB = CommandBar_Create(hInst, hWnd, 1);                  <br>                  CommandBar_InsertMenubar(hwndCB, hInst, IDM_MENU, 0);<br>                  CommandBar_AddAdornments(hwndCB, 0, 0);<br>                  break;<br>            case WM_PAINT:<br>                  RECT rt;<br>                  hdc = BeginPaint(hWnd, &ps);<br>                  GetClientRect(hWnd, &rt);<br>                  LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);<br>                  DrawText(hdc, szHello, _tcslen(szHello), &rt, <br>                        DT_SINGLELINE | DT_VCENTER | DT_CENTER);<br>                  EndPaint(hWnd, &ps);<br>                  break;<br>            case WM_DESTROY:<br>                  CommandBar_Destroy(hwndCB);<br>                  PostQuitMessage(0);<br>                  break;<br>            default:<br>                  return DefWindowProc(hWnd, message, wParam, lParam);<br>   }<br>   return 0;<br>}<br><br>// Mesage handler for the About box.<br>LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)<br>{<br>      RECT rt, rt1;<br>      int DlgWidth, DlgHeight;      // dialog width and height in pixel units<br>      int NewPosX, NewPosY;<br><br>      switch (message)<br>      {<br>            case WM_INITDIALOG:<br>                  // trying to center the About dialog<br>                  if (GetWindowRect(hDlg, &rt1)) {<br>                        GetClientRect(GetParent(hDlg), &rt);<br>                        DlgWidth      = rt1.right - rt1.left;<br>                        DlgHeight      = rt1.bottom - rt1.top ;<br>                        NewPosX            = (rt.right - rt.left - DlgWidth)/2;<br>                        NewPosY            = (rt.bottom - rt.top - DlgHeight)/2;<br>                        <br>                        // if the About box is larger than the physical screen <br>                        if (NewPosX < 0) NewPosX = 0;<br>                        if (NewPosY < 0) NewPosY = 0;<br>                        SetWindowPos(hDlg, 0, NewPosX, NewPosY,<br>                              0, 0, SWP_NOZORDER | SWP_NOSIZE);<br>                  }<br>                  return TRUE;<br><br>            case WM_COMMAND:<br>                  if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))<br>                  {<br>                        EndDialog(hDlg, LOWORD(wParam));<br>                        return TRUE;<br>                  }<br>                  break;<br>      }<br>    return FALSE;<br>}<br><br><br>But there are many other files (resources,...).<br>What should be wrong with my other sourcecode?<br><br><br><br>
User avatar
Daywalker
pm Member
 
Posts: 15
Joined: Jun 26, 2001 @ 5:58pm


Re: Develop for Windows 2.0 using eMbedded 3.0?

Postby jongjungbu » Jun 27, 2001 @ 1:39pm

Oh. Well, there doesn't seem to be anything wrong with your HelloWorld source. But, the previous source post was definitely incomplete. Ultimately, it lacked any message handling loop and thus is why its unresponsive to your input.
User avatar
jongjungbu
Not JongJongBu
 
Posts: 3112
Joined: Jun 19, 2001 @ 4:22am
Location: USA


Re: Develop for Windows 2.0 using eMbedded 3.0?

Postby Daywalker » Jun 27, 2001 @ 1:46pm

Should this work:<br><br>// 3333e.cpp : Defines the entry point for the application.<br>//<br><br>#include "stdafx.h"<br>#include <string.h><br>#include <mmsystem.h><br>#include "resource.h"<br><br>int WINAPI WinMain(      HINSTANCE hInstance,<br>                              HINSTANCE hPrevInstance,<br>                              LPTSTR    lpCmdLine,<br>                              int       nCmdShow)<br>{<br> <br><br><br>      MessageBox(NULL, L"Hello",L"Hello",MB_OK | MB_ICONINFORMATION); <br><br>      PlaySound(L"sound.wav",NULL,SND_FILENAME | SND_LOOP); <br>                       <br><br><br>      //exit program   <br>    return(0); <br><br><br>} <br>//end WinMain <br><br><br>Ive got the wav file in the same directory.
User avatar
Daywalker
pm Member
 
Posts: 15
Joined: Jun 26, 2001 @ 5:58pm


Re: Develop for Windows 2.0 using eMbedded 3.0?

Postby jongjungbu » Jun 27, 2001 @ 1:54pm

I don't see that working. Your WinMain should initiliaze the application, yet you have not even touched the handle to the current instance of the application (hInstance). Also, you are not even displaying the main window, nor enter a message retrieval-and-dispatch loop. It's possible to make a dialog-window based application..however..you still need a message loop to capture input from the application and process it.<br>My recommendation is to use the Hello World source code and build your application from there--adding your source to it as there is not much to remove from the original source to make it your own.
User avatar
jongjungbu
Not JongJongBu
 
Posts: 3112
Joined: Jun 19, 2001 @ 4:22am
Location: USA


Re: Develop for Windows 2.0 using eMbedded 3.0?

Postby Daywalker » Jun 27, 2001 @ 2:05pm

Cant anybody else please post me the source for an app for wince2.0 (using eMB 3.0) that does nothing else than showing a messagebox?
User avatar
Daywalker
pm Member
 
Posts: 15
Joined: Jun 26, 2001 @ 5:58pm


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron