Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Business Logic Function WriteSchedule 1

Status
Not open for further replies.

nitindangare

Programmer
Oct 9, 2003
4
IN
Hi all,

I am using VC++ to access the functions exported by the GM5s32.dll/GM6s32.dll. I need to support both dBASE and SQL Server as back-end. My aim is to schedule an Activity using WriteSchedule (business logic function) through my Application.

Here is what I am doing:

1. LoadLibrary(GM5s32.dll)
2. Get the function pointers for all the required function to achieve my target such as GMW_LoadBDE, GMW_UnLoadBDE, etc.
3. Load the BDE by calling GMW_LoadBDE(...)
4. Create an Name/Value pair GMW_NV_Create()
5. Set all the required fields using the GMW_NV_SetValue(..).
6. Using GMW_Execute I am calling the business logic function GMW_Execute("WriteSchedule",..)
7. Delete the Name/Value pair using GMW_NV_Delete()
8. Unload the BDE using GMW_UnloadBDE(..)
9. Finally Unload the DLL using FreeLibrary(...)

These above 9 step are executed perfectly when the back-end is dBASE, and I can see an Scheduled Activity in GM.

When I change GM's back-end to SQL Server, the GMW_Execute() in step 6 returns a error "0". Which implies Failure to Schedule the Activity.

Please let me know what is the step that I missed in case of SQL Server as back-end? I am stuck in this case and need to make it work for both the back-ends. Please note I am not changing any paths that I pass to LoadBDE(...) in both the case (dBASE and SQL Server).
My call to LoadBDE is as follows:
LoadBDE("c:\program files\goldmine", "c:\program files\goldmine\GMBase", "c:\program files\goldmine\common", "", "")
Please let me know is there anything else I need to do? in case of SQL Server.

Any help will be appreciated. Desporately need help...

Thanks in advance,
you can send a mail to nitin_dangare@yahoo.com

Nitin Dangare
 
your commondir and golddir paths in the case of SQL will nt be dbase paths (to common and gmbase folders) but will instead look more like MSSQL: mssql_goldmine: dbo.... You can do a DDE call to GoldMine for the &commondir and &Golddir before you load the BDE to find out the proper values to put here. You can also see the values and code them manually if you take a look in help|About|System in GoldMine. Note also, when you loadBDE under SQL you'll need to pass the SQL username and password as well...
 
Thanks Goner,

You will surely get a star from me!!!

Indeed your suggestion works all right. I can under stand what you are saying. My test app is unaware of what GM is connected to and I need to get the above properties at runtime and depending on GM instance. SO your suggestion about getting the properties like &commondir and &GoldDir through DDE is a good solution. If possible please let me know about the following :

1. How to get the &commondir and &GoldDir? I can do the following but donno what should I do in case of "&commondir"?

strTemp = _T("[INSHISTORY(\"") + strAccountNumber + _T("\",\"");
strTemp += strRecordType + _T("\",\"");
strTemp += strReference + _T("\",\"");
strTemp += strActivityCode + _T("\",\"");
strTemp += strResultCode + _T("\",\"");
strTemp += strUser + _T("\")]");
BOOL bRetVal = TRUE;
DWORD dwResult = 0;
DdeClientTransaction((PBYTE)LPCTSTR(strTemp), strTemp.GetLength() + 1, m_hConv, 0, 0, XTYP_EXECUTE, TIMEOUT_ASYNC, &dwResult);

2. Is there any way I can avoid DDE and still get the "&commondir" and "&GoldDir"? If yes, how?

Really appreciate your help...thanks a lot again..

Nitin Dangare

 
I added some sample VB code for easily working with DDE and GoldMine.. just pass it &commondir and &golddir and then parse the info for "MSSQL:" at the beginning and have your program login in an SQL or dBase manner accordingly.. :)



Doug Castell
Computer Control Corp
(310)396-6811
 
Hi Goner,

Thanks again...

You said you added some code... I am sorry but where have you added it? any link? Let me know I will check-it out. Secondly, I am working thourgh VC++ so I need to know what should I pass in strTemp in this call below to get the &commondir:

DdeClientTransaction((PBYTE)LPCTSTR(strTemp), strTemp.GetLength() + 1, m_hConv, 0, 0, XTYP_EXECUTE, TIMEOUT_ASYNC, &dwResult);

I appreciate your help...

Thanks,

Nitin
 
You should only have to pass "&commondir" to the dde engine and GoldMine will return the value. My apologies, but I'm no good with C... the last/closes thing I have done to C any flavor was turbo pascal in high school! :)

Hope this helps though...

Doug Castell
Computer Control Corp
(310)396-6811
 
Hi Goner,

Thanks a lot,

I found out my mistake ,
I was sending the strTemp as "[&commondir]"...
Finally I found that I need to send "&commondir"...
Everything worked as per my requirements.

I will surely like to add a small "How to" or may be FAQ for all the members here who would like to do all this stuff in VC++. I will plan a doc and will update soon...Let me know your suggestion on writing this FAQ.

For all member, please feel free to ask your queries related with talking to GM through, DDE, GM's Business Logic Functions through DLL's using VC++.

I really appreciate your help Goner...
Goner, thanks a lot for making my life easy...

Thanks,

Nitin Dangare
nitin_dangare@yahoo.com
 
I think my VB FAQ has been approved and added now... I'm new to this forum and since I could see my FAQ, I figured you could too.. Guess there's a waiting period or something...

I'll look forward to your C++ FAQ

You're welcome! :)



Doug Castell
Computer Control Corp
(310)396-6811
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top