Expert Software Company : News

miercuri, 12 mai 2010

(VFP) Retrieving VFP runtime DLL name required by EXE or DLL

VFP stores in EXE/DLL information about what runtime DLL is required to run it.

? VfpVersionFromExeOrDll("C:\Program Files\My Company\MyVfpApplication.exe")
? VfpVersionFromExeOrDll("X:\Somefolder\MyVfpDll.dll")

* VfpVersionFromExeOrDll.PRG
FUNCTION VfpVersionFromExeOrDll
LPARAMETERS tcExeDllName
LOCAL lcSig, lnHandle, lcVersion, lcBuffer, lnPos, lcSigMT
lnHandle = FOPEN(tcExeDllName, 0)
IF lnHandle < 0
? FERROR()
RETURN "Unable to Open file + '" + tcExeDllName + "'"
ENDIF
lcSig = "VisualFoxProRuntime."
lcSigMT = "VisualFoxProRuntimeMT."
lcVersion = "(Unknown)"
* Read first 64KB
lcBuffer = FREAD(lnHandle, 65535)
* Check for regular runtime signature
lnPos = AT(lcSig, lcBuffer)
IF lnPos > 0
*lcVersion = "Vfp " + STRTRAN(SUBSTR(lcBuffer, lnPos + LEN(lcSig),2), CHR(0), "") + ".0"
lcVersion = "Vfp" + STRTRAN(SUBSTR(lcBuffer, lnPos + LEN(lcSig),2), CHR(0), "") + "R.dll"
ELSE
* Check for Multithreaded (MT) runtime signature
lnPos = AT(lcSigMT, lcBuffer)
IF lnPos > 0
*lcVersion = "Vfp MT " + STRTRAN(SUBSTR(lcBuffer, lnPos + LEN(lcSigMT),2), CHR(0), "") + ".0"
lcVersion = "Vfp" + STRTRAN(SUBSTR(lcBuffer, lnPos + LEN(lcSigMT),2), CHR(0), "") + "T.dll"
ENDIF
ENDIF
=FCLOSE(lnHandle)
RETURN lcVersion

(VFP) Class Not Licensed For Use

This is because some of the MS Active X controls need a developer license, otherwise the CREATEOBJECT() doesn't work. An easy workaround is to add the Active X to a form or form class and make calls to the Active X controls on this form. The license information is stored in the Registry in this key: HKEY_CLASSES_ROOT\Licenses. It'll probably work fine if you add the license info to your customer's registry. It just takes a little while to identify the correct license code for your the Active X control. Also, it is important to take note of the default value in the HKEY_CLASSES_ROOT\Licenses key:

Licensing: Copying the keys may be a violation of established copyrights.

Read more about it in the MSKB.
INFO: OLE Control Licensing in Visual FoxPro

http://support.microsoft.com/default.aspx?scid=KB;en-us;139154

I ran into a similar problem trying to use MSCOMM32.OCX on a client's machine. I searched for a fix in Microsoft's KB and found Microsoft Knowledge Base Article - 192693. Check it out at http://support.microsoft.com/default.aspx?scid=kb;EN-US;192693. Their suggestion is to subclass the control and instantiate the subclass. Worked for me.

(VFP) Inregistrari DUBLE tabela

SELECT * FROM myTable UNION SELECT * FROM myTable

OR

SELECT account_id FROM customer GROUP BY account_id ;
HAVING COUNT(account_id) > 1

OR

SELECT first_name + last_name AS cust_name ;
FROM customer GROUP BY first_name + last_name ;
HAVING COUNT(first_name + last_name) > 1

OR

SELECT * FROM customer WHERE account_id IN ;
(SELECT account_id FROM customer GROUP BY account_id ;
HAVING COUNT(account_id) > 1)

OR

SELECT * FROM myTable WHERE myField IN ;
(SELECT myField FROM myTable ;
GROUP by myField HAVING COUNT(myField) > 1);
INTO CURSOR myDuplicates

(VFP) - How To Calling Store Procedure From VFP

USING SQL SERVER:
=======================
MYSTS = "EXECUTE MYQUE"
SQLEXEC(1, MYSTS, "MYCURSOR")


USING MYSQL:
=================
MYSTS = "CALL MYQUE();"
SQLEXEC(1, MYSTS, "MYCURSOR")

Configuring SQL Server authentication for MSDE and MS SQL Server

By default, when you install MSDE it is configured to support Windows authentication only. Windows authentication is usually not appropriate for web applications such as Enterprise Server, so you will have to override the default installation settings. Additionally, the setup program for MSDE has a bug, so even if you run the MSDE setup program with the parameter SECURITYMODE=SQL it will ignore this parameter and leave the security mode set to Windows Authentication only. As such, once you have installed MSDE, you will have to manually change the security mode for the MSDE Server by making some changes to the windows registry.
The following is a brief description of this process. For further information, refer to http://support.microsoft.com/kb/Q322336/EN-US/

I. Manually changing the authentication settings for SQL Server 2005 and SQL Server 2005 Express servers

You can change the Authentication mode on existing MSDE Servers by modifying a value in the windows registry, as follows:

1.Run the registry editor (Select Start | Run from the windows start menu, type regedit and then click OK).

2.Locate the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.x\MSSQLServer

(Note If you are using SQL Server 2005, the above registry key is used to store the authentication mode regardless of whether you installed a default instance or a named instance. MSSQL.x is a placeholder for the corresponding value for your system).

3.Set the value LoginMode to 2. This tells your server to accept SQL Server & Windows authentication methods.

4.Make sure to stop and restart the MSSQL service after making this change. You can do this by executing the two following commands from the command prompt

NET STOP MSSQLSERVER
NET START MSSQLSERVER

II. Manually changing the authentication settings for SQL Server 2000 and MSDE 2000 servers

You can change the Authentication mode on existing MSDE Servers by modifying a value in the windows registry, as follows:

1.Run the registry editor (Select Start | Run from the windows start menu, type regedit and then click OK).

2.Set the value HKLM\Software\Microsoft\MSSqlserver\MSSqlServer\LoginMode to 2. This tells your server to accept SQL Server & Windows authentication methods.

(Note: If you used a Named Instance when you installed MSDE, then the key will be HKLM\Software\Microsoft\Microsoft SQL Server\Instance Name\MSSqlserver\LoginMode).

3.Make sure to stop and restart the MSSQL service after making this change. You can do this by executing the two following commands from the command prompt

NET STOP MSSQLSERVER
NET START MSSQLSERVER

How to Change MSDE 'sa' password

Change your MSSQL Server or MSDE password for 'sa' login

C:\osql -U sa

1>sp_password NULL,'new_password','sa'
2>go
3>quit

Fix Generic Host For Win32 and Svchost.exe Error

Now we no longer have to worry about “Generic Host for Win32 Process” and “svchost.exe” errors that haunt our Windows XP almost daily (If not cured). Below i will explain what are the symptoms of this evil problem and how easily it can be fixed:

Symptoms:
You are surfing the internet or are engaged any type of Internet activity when suddenly all your Network activity goes to hault. You can still see the Internet connected icon in the tray but you cannot surf, browse or do anything.
You get an error message something like “Generic Host Process for Win32 Services has encountered a problem and needs to close. We are sorry for the inconvenience.”
Error message reporting about faulting netapi32.dll and svchost.exe.
You try to disconnect your Internet because of no activity observed but the Internet icon wont disappear.
You recieve an error message something like “Your PC has recovered from a serious problem” etc.

Solution:

Follow these simple steps and your Windows will be fully cured of this menace

Close Port 445:

1. Start Registry Editor (Regedit.exe) by clicking Start menu, and then click the Run icon.
2. In the small box that Opens, type: regedit then click the OK button. The Registry Editor will now have opened.
3. Locate the following key in the registry:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NetBT\Parameters
In the right-hand side of the window find an option called TransportBindName.
Double click that value, and then delete the default value, thus giving it a blank value.

Close Port 135:

1. Then you must now navigate to the following registry key:
HKEY_LOCAL_MACHINE\Software\Microsoft\OLE
2. You will see there is a String Value called: EnableDCOM
Set the value to: N (it should currently be Y)
3. Close the Registry Editor. Shutdown and Restart your computer.

Well thats all but if you want you can disable NETbios.