dragonlord Posted June 5, 2007 Share Posted June 5, 2007 (edited) I need to call a method named GetServerList from a com object . (It's an object of IBM QMF editor for windows). The API documentation says the following abt the function. short GetServerList(VARIANT* List) Description ------------- This function returns an array containing the names of the database servers defined in QMF for Windows's Server Definition File (SDF). You must define a database server in the SDF file if you want to access it using the QMF for Windows API. Parameters ------------- Name : List Description : A pointer to a VARIANT in which the result is stored. The result is an array of strings (variant type VT_ARRAY | VT_BSTR), with each string containing the name of one database server. If you have not defined any database servers, the result is empty (variant type VT_EMPTY). You must properly initialize the VARIANT before calling this function. Visual Basic does this automatically. Visual C++ programmers must call VariantInit(). [Due to a bug in Microsoft Excel 7.0 and Microsoft other 32-bit Microsoft products that use Visual string data in Variant variables received from QMF translated from Unicode (used by OLE) to ANSI occurs, only the first character of the string is problem, set the variable equal to an empty string for Windows function that uses the variable. Note] Now to my problem : What kinda parameter should i be passing to the function ? I tried the below Dim $myArray[5] $oQMFWin.GetServerList($myArray) But i get a ComError with description : TypeMismatch Somebody can point out what i'm doing wrong ? Edited June 5, 2007 by dragonlord Link to comment Share on other sites More sharing options...
dragonlord Posted June 5, 2007 Author Share Posted June 5, 2007 (edited) was it that confusing ? in short, what is the autoit equivalent for the following vb code ?? Dim myServerList As Variant QMFWin.GetServerList(myServerList) what type should myServerList be in autoit. I tried myServerList[5], gave type mismatch com error. Edited June 5, 2007 by dragonlord Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 5, 2007 Share Posted June 5, 2007 (edited) was it that confusing ? in short, what is the autoit equivalent for the following vb code ?? Dim myServerList As Variant QMFWin.GetServerList(myServerList) what type should myServerList be in autoit. I tried myServerList[5], gave type mismatch com error. All variables in AutoIt are C type 'variant'. Read the help file under Variables. Your code translates in AutoIt to: Dim $myServerList $QMFWin.GetServerList($myServerList) P.S. Is this from page 138 of "A DB2 Enterprise Query Environment Build It with QMF forWindows!"? Edited June 5, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
dragonlord Posted June 7, 2007 Author Share Posted June 7, 2007 I did c it in the help doc, and i tried with just Dim variable, and using that, but still it gave a Type mismatch. My understanding is that the Autoit variant means the type can be anything, but not a collection, whereas the dll function expects a collection object variable to give out it's result. [it is from the pdf u mentioned. :-) ] All variables in AutoIt are C type 'variant'. Read the help file under Variables. Your code translates in AutoIt to: Dim $myServerList $QMFWin.GetServerList($myServerList) P.S. Is this from page 138 of "A DB2 Enterprise Query Environment Build It with QMF forWindows!"? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now