473,545 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application Activation using VC

hi,
I am working with a ICA32 citrix client from windows xp, where I
am trying to use some automation through citrix client so that I can
unmann a tedious file-copy through one of the published apps (Windows
Explorer). I've tried it through VB and found out that SendKeys wont
work with Citrix, so I switched to VC. With some googling this is where
I've reached.

void ReallySetForegr oundWindow( HWND hWnd )
{
DWORD foregroundThrea dID; // foreground window thread
DWORD ourThreadID; // our active thread

// If the window is in a minimized state, maximize now
if (GetWindowLong( hWnd, GWL_STYLE) & WS_MINIMIZE)
{
ShowWindow(hWnd , SW_MAXIMIZE);
UpdateWindow(hW nd);
}
// Check to see if we are the foreground thread
foregroundThrea dID = GetWindowThread ProcessId(GetFo regroundWindow( ),
NULL);
ourThreadID = GetCurrentThrea dId();
// If not, attach our thread's 'input' to the foreground thread's
if (foregroundThre adID != ourThreadID)
AttachThreadInp ut(foregroundTh readID, ourThreadID, TRUE);

// Bring our window to the foreground
SetForegroundWi ndow(hWnd);

//if we attached our thread, detach it now
if (foregroundThre adID != ourThreadID)
AttachThreadInp ut(foregroundTh readID, ourThreadID, FALSE);

// Force our window to redraw
InvalidateRect( hWnd, NULL, TRUE);
}

I am using an .ICA file which has a predefined credentials so that
login is automated, but before I log in to Citrix, there is a network
login-warning message that pops up and I need to hit an ENTER here
programmaticall y. So, I am trying to bring the small dialog to the
front and send it a VK_RETURN with some code like this:

Sleep(2000);
PostMessage(hWn d, WM_KEYDOWN, VK_RETURN, 0x8001);
PostMessage(hWn d, WM_KEYUP, VK_RETURN, 0xc001);

however, this doesnt happen coz the dialog box never activates! I can
see that the application is set to the foreground but the window to
which ENTER has to be sent looks inactive!! It really doesnt make any
sense as the HWND obtained thru spy++ is exactly the one I am passing
to this function.

can anyone please throw some light on to why this could happen? Am I
doing something wrong?

Jan 4 '06 #1
3 1672
could this be your problem? (see below)
i had the same problem once, and it was caused by this.

see
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003 FEB.1033/winui/winui/windowsuserinte rface/windowing/windows/windowreference/windowfunctions/setforegroundwi ndow.htm
for more info.

kind regards
Bruno.

With this change, an application cannot force a window to the foreground
while the user is working with another window. Instead, Foreground and
Background Windows will activate the window (see SetActiveWindow ) and call
the function to notify the user. However, on Microsoft® Windows® 98 and
Windows Millennium Edition (Windows Me), if a nonforeground thread calls
SetForegroundWi ndow and passes the handle of a window that was not created
by the calling thread, the window is not flashed on the taskbar. To have
SetForegroundWi ndow behave the same as it did on Windows 95 and Microsoft
Windows NT® 4.0, change the foreground lock timeout value when the
application is installed. This can be done from the setup or installation
application with the following function call:

SystemParameter sInfo(SPI_SETFO REGROUNDLOCKTIM EOUT, 0, (LPVOID)0,
SPIF_SENDWININI CHANGE | SPIF_UPDATEINIF ILE);
This method allows SetForegroundWi ndow on Windows 98/Windows Me and Windows
2000/Windows XP to behave the same as Windows 95 and Windows NT 4.0,
respectively, for all applications.



"kill.segfa ult" <ki***********@ gmail.com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...
hi,
I am working with a ICA32 citrix client from windows xp, where I
am trying to use some automation through citrix client so that I can
unmann a tedious file-copy through one of the published apps (Windows
Explorer). I've tried it through VB and found out that SendKeys wont
work with Citrix, so I switched to VC. With some googling this is where
I've reached.

void ReallySetForegr oundWindow( HWND hWnd )
{
DWORD foregroundThrea dID; // foreground window thread
DWORD ourThreadID; // our active thread

// If the window is in a minimized state, maximize now
if (GetWindowLong( hWnd, GWL_STYLE) & WS_MINIMIZE)
{
ShowWindow(hWnd , SW_MAXIMIZE);
UpdateWindow(hW nd);
}
// Check to see if we are the foreground thread
foregroundThrea dID = GetWindowThread ProcessId(GetFo regroundWindow( ),
NULL);
ourThreadID = GetCurrentThrea dId();
// If not, attach our thread's 'input' to the foreground thread's
if (foregroundThre adID != ourThreadID)
AttachThreadInp ut(foregroundTh readID, ourThreadID, TRUE);

// Bring our window to the foreground
SetForegroundWi ndow(hWnd);

//if we attached our thread, detach it now
if (foregroundThre adID != ourThreadID)
AttachThreadInp ut(foregroundTh readID, ourThreadID, FALSE);

// Force our window to redraw
InvalidateRect( hWnd, NULL, TRUE);
}

I am using an .ICA file which has a predefined credentials so that
login is automated, but before I log in to Citrix, there is a network
login-warning message that pops up and I need to hit an ENTER here
programmaticall y. So, I am trying to bring the small dialog to the
front and send it a VK_RETURN with some code like this:

Sleep(2000);
PostMessage(hWn d, WM_KEYDOWN, VK_RETURN, 0x8001);
PostMessage(hWn d, WM_KEYUP, VK_RETURN, 0xc001);

however, this doesnt happen coz the dialog box never activates! I can
see that the application is set to the foreground but the window to
which ENTER has to be sent looks inactive!! It really doesnt make any
sense as the HWND obtained thru spy++ is exactly the one I am passing
to this function.

can anyone please throw some light on to why this could happen? Am I
doing something wrong?

Jan 4 '06 #2
Bruno, Thanks for the response. I tried what you said. But, It didnt
work.
The window never gets active!
I've learnt from SPy++ that the class of window is "Transparen t Windows
Client"!
I never heard about anything of this sort. Any ideas?

Jan 4 '06 #3
sorry, not for the moment. your situation is different from mine.
should i think of anything else i'll let you know.

kind regards,
Bruno.
"kill.segfa ult" <ki***********@ gmail.com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...
Bruno, Thanks for the response. I tried what you said. But, It didnt
work.
The window never gets active!
I've learnt from SPy++ that the class of window is "Transparen t Windows
Client"!
I never heard about anything of this sort. Any ideas?

Jan 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

30
3159
by: (Pete Cresswell) | last post by:
Just fired it up to see what it looked like. They wanted me to "Activate" the product before the 50th use. Geeze, I paid my money....now they want me to jump through their hoops? Brings back unpleasant memories of Intuit's QuickBooks... When did MS start this? It's not in 2000. 2002?
0
1392
by: ElGordo | last post by:
I have a .Net application which includes a function to open a command shell and run an executable (for a file extraction program, 7zip). I can run the same exact command line manually with no problems. I noticed that each time the same command line statement is run from the .Net application (always unsuccessfully), an event is logged in the...
7
1869
by: Bobby C. | last post by:
My company is in the process of getting ready (well actually QTR 2 2004) to roll out a rewritten version of a vertical market application for the municipal market (small and medium sized cities). Software protection (keeping the honest people honest) hasn't ever been a problem but in this roll out we are going to be distributing the product...
11
10094
by: ML | last post by:
Does anyone have any info on sample code for handling activation/licensing for a vb.net app? Just looking for something fairly basic to implement the ability to have an application registered and tied to a specific single PC to help reduce possible piracy. Something where the user would install the app and then send a code via email or phone...
0
3578
by: Mart | last post by:
Hi, I have just written (my first) VB.net app using MS Visual Basic 2005 Express Edition Beta. It is fairly simple, it reads some configuration data from an XML file then opens a new window containing a WebBrowser object. This all works fine and I'm happy with my app so I want to 'publish' to a setup file so that others can install it,...
6
25033
by: Josef Brunner | last post by:
Hi, I published my application (VS 2005) and am now trying to install it when I get this error message. It worked before...even on a different machine. Here is the detailed description: PLATFORM VERSION INFO Windows : 5.1.2600.131072 (Win32NT) Common Language Runtime : 2.0.50727.42
2
4525
by: Michael Kalika | last post by:
Hi, We have developed a VSTO 2005 Excel application and we would like to leverage ClickOnce deployment mechanism for distribution of this application. How can we do that? I was digging in MSDN for VSTO & ClickOnce documentation and did not find anything. I've noticed that there is an option to publish the project, but when I do that and...
0
5232
by: Tifer | last post by:
Hello, I am building my first .Net Application. The first couple of Publish and Installs I did went fine. But after a couple of builds, I get a modal dialogue box error every time upon trying to install using the setup.exe. Title is "Cannot Start Application" and it says: ==================== Cannot download the application. The...
0
3286
by: coopdog | last post by:
This is a new issue as of an install to sp1 on vb express 2005. When I publish the application to my drive then I try to install it is wants to be installed from the same location as it was originally install. Any help would be great it is a real pain having to uninstall then install this update. Also all users are admins. Thanks Mike
0
1341
by: Andrus | last post by:
I created .NET 3.5 SP1 Winforms application setup by pressing publish button in VCSE 2008 SP1 Running created setup.exe in same computer causes error below "Reference in the manifest does not match the identity of the downloaded assembly RdlDesigner.exe." and application is not installed. RDLDesigner.exe file is application created using...
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7807
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7419
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7756
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5326
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3442
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1879
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.