Friday, November 8, 2019

Send Ctrl-Alt-Del to nested RDP session


eg.
PC - A  = Its your Own Computer
PC - B  = RDP  PC - 1
PC - C =  RDP PC - 2 (Inside RDP PC1)

Here's the scenario: I Remote Desktop from Computer A to Computer B and from Computer B to Computer C.

(1) I want to send Ctrl+Alt+Del to Computer A, I type Ctrl+Alt+Del from Computer A

(2)  want to send Ctrl+Alt+Del to Computer B, I type Ctrl+Alt+End  inside Computer B

(3) If I want to send Ctrl+Alt+Del to Computer C, I open the On-Screen Keyboard on Computer C and use it to type Ctrl+Alt+End, which sends Ctrl+Alt+Del to Computer C

OR  

If I want to send Ctrl+Alt+Del to Computer C, I type Shift+Ctrl+Alt+End  inside Computer C.


Change Database default locations in SQL Server

Method 1: Change default database location via SQL Server Management Studio (SSMS):
Step 1. Right Click on Server and Select "Properties".



Step 2. in the "Server Properties" dialog box, navigate to "Database Settings" tab and data/log files location under "Database default locations" group.


 Step 3.  Click on "OK" to Save Changes.

Step 4.   As per Microsoft SQL Server Instance need to restart for to take effect. so Right Click on Server and Click on "Restart". It will prompt for confirmation - Press Yes. You can Restart Server Instance using Services.msc


Tuesday, October 11, 2016

Create Shortcut with RunAs Administrator using VFP


Create Shortcut with RunAs Administrator using Visual FoxPro Code.

Function CreateShortcut
Lparameters lcExecutableFile,lcShortcutText,lcProgramDesc,llRunAsAdmin

lcTmpShortCutFile  = Addbs(Getenv("TEMP")) + Sys(2015)+".lnk"

oWsh = Createobject("wscript.shell")
cDeskpath = oWsh.SpecialFolders("desktop")

lcShortcutFile = cDeskpath+"\"+lcShortcutText+".lnk"
If llRunAsAdmin
oShort = oWsh.CreateShortcut(lcTmpShortCutFile)
Else
oShort = oWsh.CreateShortcut(lcShortcutFile)
Endif

oShort.TargetPath = lcExecutableFile
oShort.WorkingDirectory = Addbs(Justpath(lcExecutableFile))
oShort.Description = lcProgramDesc
oShort.Save

If llRunAsAdmin && Creating New Shortcut with RunAs option.

nhandle     = Fopen(lcTmpShortCutFile)
nFilesize     = Fseek(nhandle,0,2)
=Fclose(nhandle)
nhandle     = Fopen(lcTmpShortCutFile)

nHandle2     =  Fcreate(lcShortcutFile)
If nhandle     = -1  &&OR nHandle2 = -1
Wait Window [both source and destination files must be accessible]
=Fclose(nhandle)
=Fclose(nHandle2)
Return
Endif

nRemain     = nFilesize
i = 0
Do While !Feof(nhandle)
nChunk     = 1 && MIN(100,nRemain)
cTake     = Fread(nhandle,nChunk)

If i=21
cTake = Chr(32)  && a[0x15] |= 0x20; // flip the bit.  for RunAsAdmin
Endif

=Fwrite(nHandle2,cTake,nChunk)
nRemain = nRemain - nChunk

i = i + 1
If nRemain = 0
Exit
Endif
Enddo
=Fclose(nhandle)
=Fclose(nHandle2)

Delete File "&lcTmpShortCutFile"
Endif
Return

Saturday, March 22, 2014

Class Library Toolbox Icon

Step 1: 

Create bmp file (16x16) and save as like below.

   ProjectNameSpace.ControlName.bmp

  e.g. Project Name : CustomGrid
        Control Name : MyGridControl

Bmp File Name :  CustomGrid.MyGridControl.bmp

Step 2: Add in Project and Change Build Action Properties to "Embedded Resources".

Stpe 3: Add ToolboxBitmap line in your class file as per screenshot.




Step 4 : Compile your Project as "Class Library".

Step 5:  Add this control in Different Solution Project Toolbox using choose items and icon will display like below ( In Same Project icon can not display).


Download Complete Source : CustomGrid.Zip