This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: CtrlGetText problem
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
‎Aug 01, 2007
02:21 AM
CtrlGetText problem
Hi all,
I have problem with getting value from dialog. I would like to get text from Customer Information dialog, but I always get empty value. Does CtrlGetText only works with user created dialogs? Here is my code (temp1 is string):
Dlg_SdCustomerInformationEx:
nResult = SdCustomerInformationEx(szTitle, svName, svCustomer, szSerial, nUser );
if (nResult = NEXT) then
CtrlGetText("SdCustomerInformationEx", 302, temp1);
MessageBox(temp, INFORMATION);
endif;
Can anyone help me how to read values from edit box?
I have problem with getting value from dialog. I would like to get text from Customer Information dialog, but I always get empty value. Does CtrlGetText only works with user created dialogs? Here is my code (temp1 is string):
Dlg_SdCustomerInformationEx:
nResult = SdCustomerInformationEx(szTitle, svName, svCustomer, szSerial, nUser );
if (nResult = NEXT) then
CtrlGetText("SdCustomerInformationEx", 302, temp1);
MessageBox(temp, INFORMATION);
endif;
Can anyone help me how to read values from edit box?
(7) Replies
‎Aug 01, 2007
08:53 AM
Right, CtrlGetText and the like work only while the dialog function is running (before EndDialog and ReleaseDialog are called). What value are you trying to get? The variables passed in as arguments (svName, etc.) should give you access to what the user types at run time...
‎Aug 01, 2007
10:41 AM
I have a custom dialog where user inserts server name, database name, olap server, olap catalog. I succeeded to create this dialog and to pass values. But I have another problem. MsiGetProperty returns only half value. Example
Property Value
MyProp1 OLAP_Server
returns me only OLAP_S. I get property with:
MsiGetProperty(ISMSI_HANDLE, "SERVERNAME", sServer, size);
changing value size also doesn't help. Any idea?
Property Value
MyProp1 OLAP_Server
returns me only OLAP_S. I get property with:
MsiGetProperty(ISMSI_HANDLE, "SERVERNAME", sServer, size);
changing value size also doesn't help. Any idea?
‎Aug 01, 2007
11:18 AM
Does the return value from MsiGetProperty tell you anything? Could you post more of the code surrounding your MsiGetProperty call?
‎Aug 01, 2007
11:56 PM
Ok, here is more of the code. I don't know why i get only half of strings back.
Dlg_SdCustomerInformationEx:
size = 256;
MsiGetProperty(ISMSI_HANDLE, "SERVERNAME", sServer, size);
MsiGetProperty(ISMSI_HANDLE, "DATABASENAME", sDB, size);
MsiGetProperty(ISMSI_HANDLE, "OLAPSERVERNAME", sOlap, size);
MsiGetProperty(ISMSI_HANDLE, "OLAPDATABASENAME", sCatalog, size);
nResult = PeterDialog(sServer, sDB, sOlap, sCatalog);
if (nResult = BACK) goto Dlg_SdRegisterUserEx;
In property manager i have values:
SERVERNAME: Main_Server
DATABASENAME: GSSDB
OLAPSERVERNAME: OLAP_Server
OLAPDATABASENAME: GSSDB_OLAP
What I get back with reading is:
SERVERNAME: Main_Server
DATABASENAME: GSSDB
OLAPSERVERNAME: OLAP_S
OLAPDATABASENAME: GSSDB
And one funny thing. If I click on this dialog Next and then back, values are changes, like:
SERVERNAME: Main_Server
DATABASENAME: GSSDB
OLAPSERVERNAME: OLAP
OLAPDATABASENAME: GSS
??:(
Dlg_SdCustomerInformationEx:
size = 256;
MsiGetProperty(ISMSI_HANDLE, "SERVERNAME", sServer, size);
MsiGetProperty(ISMSI_HANDLE, "DATABASENAME", sDB, size);
MsiGetProperty(ISMSI_HANDLE, "OLAPSERVERNAME", sOlap, size);
MsiGetProperty(ISMSI_HANDLE, "OLAPDATABASENAME", sCatalog, size);
nResult = PeterDialog(sServer, sDB, sOlap, sCatalog);
if (nResult = BACK) goto Dlg_SdRegisterUserEx;
In property manager i have values:
SERVERNAME: Main_Server
DATABASENAME: GSSDB
OLAPSERVERNAME: OLAP_Server
OLAPDATABASENAME: GSSDB_OLAP
What I get back with reading is:
SERVERNAME: Main_Server
DATABASENAME: GSSDB
OLAPSERVERNAME: OLAP_S
OLAPDATABASENAME: GSSDB
And one funny thing. If I click on this dialog Next and then back, values are changes, like:
SERVERNAME: Main_Server
DATABASENAME: GSSDB
OLAPSERVERNAME: OLAP
OLAPDATABASENAME: GSS
??:(
‎Aug 02, 2007
01:45 AM
I fixed the problem. You have to declare size for every MsiGetProperty call, like this:
size = 256;
MsiGetProperty(ISMSI_HANDLE, "SERVERNAME", sServer, size);
size = 256;
MsiGetProperty(ISMSI_HANDLE, "DATABASENAME", sDB, size);
size = 256;
MsiGetProperty(ISMSI_HANDLE, "OLAPSERVERNAME", sOlap, size);
size = 256;
MsiGetProperty(ISMSI_HANDLE, "OLAPDATABASENAME", sCatalog, size);
🙂
size = 256;
MsiGetProperty(ISMSI_HANDLE, "SERVERNAME", sServer, size);
size = 256;
MsiGetProperty(ISMSI_HANDLE, "DATABASENAME", sDB, size);
size = 256;
MsiGetProperty(ISMSI_HANDLE, "OLAPSERVERNAME", sOlap, size);
size = 256;
MsiGetProperty(ISMSI_HANDLE, "OLAPDATABASENAME", sCatalog, size);
🙂
‎Aug 02, 2007
09:02 AM
Exactly right; on successful return, the buffer-size variable is set to the size of the data in the property value, meaning that reading a short property value followed by reading a long property value (without resetting the buffer size) will cause the second value to be cut off.
‎Aug 02, 2007
11:31 PM
This is the model I follow when calling MsiGetProperty:
szInstSource = "";
nvBufferSize = 0;
// Make first call to get the actual buffer size
// required for the SourceDir property
MsiGetProperty( ISMSI_HANDLE, "SourceDir", szInstSource, nvBufferSize );
// Increment size to account for the NULL terminator
// and then resize the string buffer
nvBufferSize++;
Resize( szInstSource, nvBufferSize );
// Make a second call to get the actual value
// of the SourceDir property
MsiGetProperty( ISMSI_HANDLE, "SourceDir", szInstSource, nvBufferSize );
szInstSource = "";
nvBufferSize = 0;
// Make first call to get the actual buffer size
// required for the SourceDir property
MsiGetProperty( ISMSI_HANDLE, "SourceDir", szInstSource, nvBufferSize );
// Increment size to account for the NULL terminator
// and then resize the string buffer
nvBufferSize++;
Resize( szInstSource, nvBufferSize );
// Make a second call to get the actual value
// of the SourceDir property
MsiGetProperty( ISMSI_HANDLE, "SourceDir", szInstSource, nvBufferSize );