Skip to main content
16-Pearl
May 25, 2016
Solved

Getting ProUISpinbox value in CREO Toolkit

  • May 25, 2016
  • 1 reply
  • 1338 views

Hi,

     I am repeatedly getting fatal error when try to get the value of spinbox, My code is below

int RunSpinBox()

{

  ProError status;

  int   i;

  char * dialog = "mcheck_plus_resource";

  ProUISpinboxIntegerGet(dialog,"ItemValue",&i);

  MessageBox(0,i,"SpinBox Value",1);

}

I have attached error file. Please anybody help to solve the issue.


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
Best answer by GabrielZaha

I'd say that the error is caused by the MessageBox function.

Here is the function prototype as described on MSDN website:

int WINAPI MessageBox(
  _In_opt_ HWND    hWnd,
  _In_opt_ LPCTSTR lpText,
  _In_opt_ LPCTSTR lpCaption,
  _In_     UINT    uType
);

First function parameter is of type HWND and you are using an constant integer (0). Second parameter has to be a string and you are passing an integer.

Normally this types of errors are captured at the compilation time.

Personally I prefer to use ProUIMessageDialogDisplay instead of MessageBox.

Other items you need to double check are the dialog and spinbox names? Do the "mcheck_plus_resource" and "ItemValue" match the names on your resource file?

1 reply

14-Alexandrite
May 26, 2016

I'd say that the error is caused by the MessageBox function.

Here is the function prototype as described on MSDN website:

int WINAPI MessageBox(
  _In_opt_ HWND    hWnd,
  _In_opt_ LPCTSTR lpText,
  _In_opt_ LPCTSTR lpCaption,
  _In_     UINT    uType
);

First function parameter is of type HWND and you are using an constant integer (0). Second parameter has to be a string and you are passing an integer.

Normally this types of errors are captured at the compilation time.

Personally I prefer to use ProUIMessageDialogDisplay instead of MessageBox.

Other items you need to double check are the dialog and spinbox names? Do the "mcheck_plus_resource" and "ItemValue" match the names on your resource file?