hi Vita, more questions. When I use SysAllocString in the "GetStatus" function, where should I call SysFreeString to free up the memory? Will the following script do? ---------- option explicit dim result result = GetStatus ("Item-A", 120, "Dummy") set result = nothing ------------ thanks a lot! - Lucy
lucy 0
Posts
-
VBScript, how to use VT_BSTR? -
VBScript, how to use VT_BSTR?got it. Thanks a lot, Vi2!
-
VBScript, how to use VT_BSTR?I am new to COM and VBSCript. I am trying to get an automation function to return a status text string, so when writing script, the tester knows the status of an object under test. This is how I declare and define the function: DISP_FUNCTION(CScriptObject, "GetStatus", GetStatus, VT_BSTR, VTS_BSTR VTS_I4 VTS_BSTR) BSTR CScriptObject::GetStatus(LPCTSTR Item, int ID, LPCTSTR WhichStatus) { return L("test"); } the script is as follows: dim string; string = GetStatus "Item-A", 120, "Dummy" When running it, virtual HRESULT __stdcall OnScriptError(IActiveScriptError *pscriptError) gives me the an error message, saying "string = GetStatus "Item-A", 120, "Dummy"" has error. But running (GetStatus "Item-A", 120, "Dummy") alone is ok. By "ok" I mean the automation function "GetStatus" will be called. Any idea how to have "GetStatus" to return some test string which can be used by VBScript? Thank you very much in advance!
-
MIDL_user_freeI see why it's called _user_ now. At first I thought it's my RpcRt4.lib which is not up-to-date. Thank you very much, Hans.
-
MIDL_user_freeI'm learning RPC (remote procedure call). I included "rpcndr.h", and add "Rpcrt4.lib" in object/library modules. When compiling, I got the following errors: Linking... interface_c.obj : error LNK2001: unresolved external symbol _MIDL_user_free@4 interface_c.obj : error LNK2001: unresolved external symbol _MIDL_user_allocate@4 Debug/22_rpc.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. what am I missing? I am using VC6.0. Thanks a lot for any help!
-
get netmask information when other IP address is knownI've tried this for quite a while, still clueless. :mad: I used WNetOpenEnum and WNetEnumResource to obtain the IP address of other PC connected to my neighborhood. Now I want to know the subnet mask settings and gateway settings of them. What functions to use? I know structure INTERFACE_INFO contains field iiNetmask, which is the network mask, but which function can give me this structure as an output? thank you very much for the help!
-
network querythank you, this is very helpful. I then found this article: http://www.codeproject.com/internet/ipaddress.asp[^] now I'm on my way to the solution. Thanks again!
-
network querythank you very much, ravi. now I understand the principle. Is there any tutorial material I can read to learn more? I'm pretty new to the network programming. what I have done is limited to very basic stuff, such as one-to-one send/recv applciation. thanks again!
-
network queryravi, Thank you for the link. but the server I am thinking of is not a generic server. It's just an application which runs on another computer, but serves as server in a client/server software. maybe I can use broadcast function, but is there any better way to implement it? for example, D-Link has a network storage adapter DNS-120. It has a built-in FTP server, so files can be accessed over the internet, when the disk is connected to this adapter. It has an application called "Easy Search", which is to easily locate DNS-120 units for configuration. What I want is similar to this "Easy Search", that is, click a button on this "Easy Search" application, it will return the IP addresses of my "DNS-120" units in the same LAN. English is not first language, so I hope I made myself a bit more clear now. Thank you for any hint!
-
network queryI have a windows client application, which I want to use to communicate with a server application running on a different machine in the same LAN. To make it user friendly, instead of asking the user to input the host IP addres of the server to the client application, I want the client application to do a query in the LAN, and find out what the candidate server's IP address is, and all the user has to do is to confirm that that's the one to communicate with. I have no clue how I can get this done. Any hint would be greatly appreciated. Thanks a lot!
-
Accessing menu options from an embedded dialogthank you. that's good to know. I read wm_app again, and noticed it's said as follows: "Message numbers in the second range (WM_USER through 0x7FFF) can be defined and used by an application to send messages within a private window class. These values cannot be used to define messages that are meaningful throughout an application, because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use these values. Messages in this range should not be sent to other applications unless the applications have been designed to exchange messages and to attach the same meaning to the message numbers. "
-
Accessing menu options from an embedded dialogWM_MENU_CELSIUS is not a standard message. It's a user message. You have to define it. For example, in your header file moteDataDlg.h, add the following: #define WM_MENU_CELSIUS (WM_USER + 100) for more information on WM_USER, check its entry in MSDN. All the best!
-
Accessing menu options from an embedded dialogI would assume you handle the menu by your main dialog, and pass the message down to your embedded dialog for further process. say, CMyMainDialog::OnMenuCelsius () { SendMessage (pEmbedDialog->m_hwnd, WUM_MENU_CELCIUS); } CMyEmbedDialog::WindowProc (UINT message, WPARAM wParam, LPARAM lParam ) { if (message == WUM_MENU_CELCIUS) { /* display raw units to celcius values */ } }
-
PROP_SM_CXDLGin my SDI VC6.0 project, I have two property sheets in my form view. I want the left one to be skinny, so I can make the right one wider. I used IDD_PROPPAGE_SMALL as the template for the property pages in the left property sheet, and set the dimension to be 150x265 dialog units. But somehow, the left sheet is still pretty big. I googled a bit, and it turned out the limitation is PROP_SM_CXDLG defined in prsht.h. I add thse to mypropertypage.h, but they don't seem to work. Anyone can point out what I did wrong please? TIA! #ifdef PROP_SM_CXDLG #undef PROP_SM_CXDLG #define PROP_SM_CXDLG 150 #endif #ifdef PROP_MED_CXDLG #undef PROP_MED_CXDLG #define PROP_MED_CXDLG 150 #endif #ifdef PROP_LG_CXDLG #undef PROP_LG_CXDLG #define PROP_LG_CXDLG 150 #endif
-
Change remotely a text// CEdit m_edit; m_edit.SetWindowText ("your text");
-
CMyDocument::Serialize(CArchive& ar) is not calledsure, I will. I am not at work today. Caught a cold. I will post the code tomorrow. Thank you very much!
-
CMyDocument::Serialize(CArchive& ar) is not called:~ I don't think I posted any code yesterday. and I didn't make any changes to CMyDocument, only updated the CMyDocument::Serialize (), added code to serialize my member variables to &ar.
-
CMyDocument::Serialize(CArchive& ar) is not calledI have an SDI application, with a form view, which has a few property sheets displayed. When I click on "Open" button from the tool bar, to my surprise, CMyDocument::Serialize(CArchive& ar) is not called, and the title is updated by my selected file name. How can this happen?!:doh::confused: TIA!
-
convert integer value to string objcet?I would use str_n.Format ("%d", n)
-
unit testhere's the sample code:
BOOL IsValid(MyType *p) { /* test whether MyType *p is valid. * if valid, return TRUE. * return FALSE otherwise */ ..... } void TestIsValid () { MyType a; BOOL bRet; bRet = IsValid (&a); printf ("IsValid( ) returns %d.\n", bRet); }
So I don't see I can use what you recommended first as:BOOL IsValid (MyType *p) { ... #ifdef _DEBUG TestIsValid(); #endif }
I hope I made myself clear this time.