op2_sdk:textdialogbox

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
op2_sdk:textdialogbox [2016/03/28 13:35] vagabondop2_sdk:textdialogbox [2016/03/28 18:16] vagabond
Line 8: Line 8:
   * Add a resource script (.rc) to the project detailing the design of the dialog box.   * Add a resource script (.rc) to the project detailing the design of the dialog box.
   * Add a resource header file (typically resource.h) to the project providing a link between the resource script file and the rest of the source code.   * Add a resource header file (typically resource.h) to the project providing a link between the resource script file and the rest of the source code.
 +  * Include odasl in your project.
   * Add code to the scenario that formats and opens the dialog screen through the windows API.   * Add code to the scenario that formats and opens the dialog screen through the windows API.
  
Line 49: Line 50:
 To add a resource script file and associated resource header: To add a resource script file and associated resource header:
  
-right click on your project in the solution explorer. -> Add -> New Item... -> Visual C++ -> Resource -> Resource File (.rc) -> Add.+  - Right click on your project in the solution explorer. -> Add -> New Item... -> Visual C++ -> Resource -> Resource File (.rc) -> Add.
  
 Resource Scripts by default is placed in the Resource Files filter in the Solution Explorer. Use the Solution Explorer (or your favorite text editor) to open the file file in text view. You can also access the Resource Script from the Visual Studio Resource View, which defaults to opening on the left side of Visual Studio. The Resource View allows graphical depiction of Dialog Boxes defined in the resource script file. Alternative programs like Resource Hacker can also load Resource Scripts. Resource Scripts by default is placed in the Resource Files filter in the Solution Explorer. Use the Solution Explorer (or your favorite text editor) to open the file file in text view. You can also access the Resource Script from the Visual Studio Resource View, which defaults to opening on the left side of Visual Studio. The Resource View allows graphical depiction of Dialog Boxes defined in the resource script file. Alternative programs like Resource Hacker can also load Resource Scripts.
Line 57: Line 58:
 For more information on TEXTINCLUDE, see: https://msdn.microsoft.com/en-us/library/6t3612sk.aspx. For more information on TEXTINCLUDE, see: https://msdn.microsoft.com/en-us/library/6t3612sk.aspx.
  
-#ifdef //identifier// If defined directive. Execute the code if the identifier is defined.+**Common Pre-processor Directives:**
  
-#ifndef //identifier// - If not defined directive. Execute the code if the identifier is not defined. +  * #ifdef //identifier// - If defined directive. Execute the code if the identifier is defined. 
- +  * #ifndef //identifier// - If not defined directive. Execute the code if the identifier is not defined. 
-#undef //identifier// - Undefined directive. Removes the definition of an identifier.+  #undef //identifier// - Undefined directive. Removes the definition of an identifier.
  
 +**Resource Script Sample**
 <code cpp> <code cpp>
 // Microsoft Visual C++ generated resource script. // Microsoft Visual C++ generated resource script.
Line 221: Line 223:
  
 ===== Resource.h  ===== ===== Resource.h  =====
 +
 +Once the Resource Script is added, the project will not successfully compile until all required items are defined in the resource header. Visual Studio will automatically create a resource header when the resource script is created. Typically, 5 items are defined in resource script as shown in the sample below, IDR_MISSIONTEXT, IDB_PIC, IDD_MISSIONINFO, IDC_TEXTAREA, and IDC_PIC. These values are represented in the resource script.
  
 Microsoft Resource Naming and Numbering Conventions can be reviewed here: https://msdn.microsoft.com/en-us/library/t2zechd4.aspx. Microsoft Resource Naming and Numbering Conventions can be reviewed here: https://msdn.microsoft.com/en-us/library/t2zechd4.aspx.
Line 235: Line 239:
 **Note:** //0x prefix on a number indicates it is in hexadecimal form.// **Note:** //0x prefix on a number indicates it is in hexadecimal form.//
  
 +**Resource Header Example**
 <code cpp> <code cpp>
 //{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
Line 261: Line 266:
 ===== Creating the Dialog Box in Code ===== ===== Creating the Dialog Box in Code =====
  
-Once the resource script and resource header have been well formed, the briefing screen should be called from the beginning of ''InitProc''. You will have to include the Sierra library odasl.h in your project.+Once the resource script and resource header have been included, the briefing screen must be initialized from the code. You will also have to include the Sierra library odasl in your project to ensure the dialog is formatted similar to other Outpost 2 menus.
  
-Firstyou will require handle to the DLL instance from DllMain.+  - Add odasl.h and odasl.lib to your project. Typicallyfiles are placed in subfolder/project filter. 
 +  - Create a reference to the DLL instance from DllMain (HINSTANCE hInst). 
 +  - Add code to initialize and open the window. Typically this code is placed in it's own cpp file named briefing.cpp. 
 +  - Call code to initialize the window from ''InitiProc''
 + 
 +**Defining a handle to the DLL instance from DllMain:**
  
 **DllMain.cpp** **DllMain.cpp**
Line 285: Line 295:
 </code> </code>
  
-**briefigin.h**+**Code used to initialize window. This also may be written without a header file.** 
 + 
 +**briefing.h**
 <code cpp> <code cpp>
 #pragma once #pragma once
  • op2_sdk/textdialogbox.txt
  • Last modified: 2016/12/28 19:03
  • by vagabond