|
OK I have 2 guesses on what you want
1. You want to know where the actual executable is located that is simple use ::GetModuleFileName
2. You assume there is a possibility to run application on a server and have it visible on the client. In a way, it is true. There are multiple technologies that support that
a. DCOM. That designed to be transparent to the client, so you have to investigate registry to find out if it has proxy and couple of difficult functions like CoGetCallContext, CoQueryProxyBlanket and CoGetObjectContext.
c. COM+ (MTS). See COM+ SDK on how to get Application information.
d. RPC. I am not sure, but I think it is possible to intercept use low level APIs
e. Proprietary software that uses sockets, pipes or some other communication means. Well it depends on what they are doing. Usually you need to use provided API
This is why I asked you about the condition you have. In example you gave there is probably no way to run MFC Dialog APP with no COM on the server, so it actually shows on the client.
|
|
|
|
|
You wrote:
OK I have 2 guesses on what you want
1. You want to know where the actual executable is located that is simple use ::GetModuleFileName
CRIS: Yes, I want to know exatly this. I used the GetDriveType function. It's work well. But I see the documentation and the GetModuleFileName function also works well.
Alex, thanks a lot ...
Cris.
|
|
|
|
|
I have a dll that has a dialog box defined in it. I would like to know how to use/display this box inside my main application. I have used LoadLibrary to load the dll, then called FindResource to obtain a handle to the Dialog Resource. Then I called LoadResource using the handle to the Dll and to the Dialog resource and all is fine. I just can't figure out what to do know with the GlobalHandle that is returned in LoadResource to actually display the dialog box and retrieve the data that is entered.
I am doing this in WinCE, but I would guess that the process shouldn't be too different.
Thanks,
-Eric
|
|
|
|
|
dear all,
i'm using Windows Xp pro with NTFS partition.
i've used LogonUser to get a token of a user and then I use the token in CreateProcessAsUser(...). I use flag LOGON32_LOGON_INTERACTIVE SO THERE IS NO NEED TO DUPLICATE THE TOKEN.
I've also set the reqd. previliges in the system.
but still when i try to execute a process, i get an error -> Access Denied (5).
I also tried to use function ImpersonateLoggedOnUser(..) (which was successful) but still I get the same Error while using function CreateProcess(...) after using ImpersonateLoggedOnUser(...)
I've even tried setting priviliges by code and manually in the OS
But still to find the same Error (error number 5).
In VB also i get the same problem
is it a bug!!!!!!!!!!!
any ideas!!!!!!!!!
thanx
|
|
|
|
|
I'm exploring an FTP site with a recursive function. If I use this function for local exploration, it gives me all the directories and files of a given drive. I've changed the function so it works for FTP. What happens is that I only get the listing of the first level directories, that is, the CFtpFileFind object only finds the files/directories in the root directory. Even if I do SetCurrentDirectory and build the string with which I do the first FileFind(), it always retrieves only in the first level.
To make a test, I manually set a directory (i did: SetCurrentDirectory("/NewYork")), and the CFtpFileFind still finds the files in "/" (root).
Is this a normal behavior of these kind of objects? What can I do to search for directories and files in an FTP in all the levels?
(I did this recursively and iteratively, none worked: the result is only the first level).
I'd appreciate any help.
-- narada
|
|
|
|
|
Here is a code snipped of how I do it, Note fileFound is a virtual method used by the derived class to do all the work.
Hope it helps, the code is just a quick hack, and not very tidy, as it implies it is recursive. I use it to do a tree delete on my FTP server.
void CFTPDirWalk::DirWalkRecurse(TCHAR* szFilename)
{
BOOL bKilled = FALSE,
bOK = FALSE;
CObArray objArray;
CString strDirPath = _T(""),
strBuffer = _T("");
DWORD dwLength = 0,
dwWaitResult = 0;
HINTERNET hFileFound = NULL;
TCHAR szBuffer[MAX_PATH + 1];
WIN32_FIND_DATA FindData;
WIN32_FIND_DATA *pFindData = NULL;
int nIndex = 0,
nLoop = 0,
nSlash = 0;
objArray.SetSize(0);
dwLength = MAX_PATH;
FtpGetCurrentDirectory(m_hFTPConnect, szBuffer, &dwLength);
m_dwRecureCounter++;
strDirPath = szBuffer;
nSlash = strDirPath.GetLength() - 1;
if(nSlash > 0)
if(strDirPath.GetAt(nSlash) != '/')
strDirPath += "/";
hFileFound = FtpFindFirstFile(m_hFTPConnect, szFilename, &FindData, INTERNET_FLAG_RELOAD, 2);
bOK = hFileFound ? TRUE : FALSE;
while(bOK && !bKilled)
{
dwWaitResult = WaitForSingleObject(m_hCloseDown, 0);
bKilled = dwWaitResult == WAIT_OBJECT_0 ? TRUE : FALSE;
if(bKilled)
continue;
if(!isDots(&FindData))
{
int nSize = sizeof(WIN32_FIND_DATA);
pFindData = (WIN32_FIND_DATA*) new WIN32_FIND_DATA;
ZeroMemory(pFindData, sizeof(WIN32_FIND_DATA));
CopyMemory(pFindData, &FindData, sizeof(WIN32_FIND_DATA));
sprintf(pFindData->cFileName, "%s%s", strDirPath, FindData.cFileName );
objArray.SetAtGrow(nIndex++, (CObject*) pFindData);
}
bOK = InternetFindNextFile(hFileFound, &FindData);
}
InternetCloseHandle(hFileFound);
for(nLoop = 0; nLoop < objArray.GetSize() && !bKilled; nLoop++)
{
pFindData = (WIN32_FIND_DATA*) objArray.GetAt(nLoop);
if(!pFindData)
continue;
if((pFindData->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
if(FtpSetCurrentDirectory(m_hFTPConnect, (LPCSTR) pFindData->cFileName))
{
dwLength = MAX_PATH;
DirWalkRecurse(szFilename);
}
}
else
{
fileFound(pFindData, m_hFTPConnect);
}
}
if(--m_dwRecureCounter > 0 && !bKilled)
{
ZeroMemory(&FindData, sizeof(WIN32_FIND_DATA));
sprintf(FindData.cFileName, strDirPath);
FindData.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
dirFoundExit(&FindData, m_hFTPConnect);
}
for(nLoop = 0; nLoop < objArray.GetSize(); nLoop++)
{
pFindData = (WIN32_FIND_DATA*) objArray.GetAt(nLoop);
if(pFindData)
delete pFindData;
}
}
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
Ted, should I establish the FTP connection and then call this function with the root directoty as parameter?
Thanks so much!
-- narada
|
|
|
|
|
|
Sorry, but it doesn't compile.
CFtpUtils doesn't exist!!!
Can I just use your initial function? Tell me how, please! (I need a bit of step by step explanation, if you don't mind)
Thanks
|
|
|
|
|
I have place the files onto my website, all it does is gets an error code.
http://www.ndrw.co.uk//download/source/FtpUtils.cpp
http://www.ndrw.co.uk//download/source/FtpUtils.h
The code was a hack, but here goes
As the saying goes "recursion see recursion" I suggest you create a simple "DOS" prog, derive your own class from CFTPDirWalk and step through the code. If you have not used recursion it is a bit confusing, but basicaly this is what is happening
in pseudo code#1 Attach to a directorystore all file & dir namesloop through theseif a dir is found then attach to it and go to #1Code description
startDirWalk() simply attaches you to the correct directory and starts the recursion
DirWalkRecurse() does the work,
Find and store the current directory in strDirPath use FtpFindFirstFile to kick start the file searchWaitForSingleObject is just a way of aborting the recursionbuild objArray with the full path of the fileLoop until all files foundOnce all files aheve been stored in objArray Loop through objArray When a directory has been found attach to it call DirWalkRecurse If not a dir then use virtual method fileFound to get the WIN32_FIND_DATA dataAfter looping build WIN32_FIND _DATA struct for the directoryUse dirFoundExit method to pass this data to the derived class
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
|
Your welcome, thanks for letting me know it worked OK.
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
hi all,
i want to know which ports of a PC are open and then i want them to open or close according to me, as well as i want to keep the ports invisible to others if they access it, even if they are open it shows if they are close. you can say in stealth mode..Like they do in firewall...please help....any idea are welcome..
if anyone can help me then please do email a copy of your answer at himanshu@sampatti.com
thanks in advance..
Himanshu
|
|
|
|
|
I have access to a database over the internet (I have user name and password) [Internet Explorer]. I would however like to enter the username and password programmatically. How can this be done?
I can easily access the database, which consists of jpg-pictures BTW, using the ShellExecute command which opens a new Internet Explorer window. I now want to integrate the IE functionality into a view in my own program. Shouldn't really be a problem, but:
I have tried to open the connection using the following code:
CInternetSession session;
CHttpConnection *connection = NULL;
CStdioFile *file = NULL;
CHttpConnection *connection = session.GetHttpConnection(url,nPort,user,pass);
CStdioFile *file = session.OpenURL(url);
The only web page I can access with this code is the page that tells me that I couldn't access the server because of bad password....
Any ideas?
Christoffer Andreas Andersen
"I'm just here to regulate the funkyness!" - Gandolfini
|
|
|
|
|
Is there not a syntax for URLs like
http://user:password@mysite.com
or perhaps
http://user:password@www.mysite.com
I'm sure that it's possible to specify credentials in this way, although for the life of me I can't remember where I've seen it done - I think on a "Members" section on a company's support website.
Steve S
[This signature space available for rent]
|
|
|
|
|
Thanks, but I figured it out myself. Using CHttpConnection::OpenRequest (), AddRequestHeaders and SendRequest I made it work fine.
Now my problem is that I can't seem to get the pictures that I download from this site to show themselves as they come in.
- I get the picture from the database and saves it locally on my harddisk.
- Then I throw the picture into an IPicture and StretchBlt's it onto my CDC...
This is all done in a nice for-loop, but only the last picture is shown.
I have CDocument::UpdateAllViews () commands in there but my CView doesn't get updated until all pics have been downloaded. Also, my whole split window application hangs until the last pic has been downloaded and in my CView.
Any ideas?
Christoffer Andreas Andersen
"I'm just here to regulate the funkyness!" - Gandolfini
|
|
|
|
|
What's the point in the following code (generated by the app wizard)?
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
Dylan Boycott Bush Punch GWB
|
|
|
|
|
Well, these two objects are different beasts. __FILE__ is a macro expanding to the name of the file, i.e. everywhere you write __FILE__ is like you're writing instead "foo.cpp" or whatever the file is called. THIS_FILE is a true variable, not a macro, and moreover is mutable, which means you could even change its contents. As for the specific use of THIS_FILE I don't really know. Scanning thru the entire source code of MFC does not reveal any use of this variable.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
To give a more formal answer than Joaquim's, this is necessary to display Debug information in the Debug Window.
~RaGE();
|
|
|
|
|
Hi,
I've written a program to test the performances of a windows timer under different work loads. In a first step we used the program under a windows 98 platform with a timer frequency of 5Hz. So every 200msec the Wintimer should sent a WM-TIME message to the OnTimer function. Because the timer tick frequency of a windows 98 platform is about 18Hz(55msec) there will be approximately a time delay of 20msec. When I start the program with no work load(0 floating point operations) the time delay is also 20 msec, so everything is normal. But when I want to increase the work load to 1.000.000 floating point operations the time delay becomes smaller. I would expect that it would increase with increasing work load!
Can anyone explain this?
Kind regards,
Geert
|
|
|
|
|
My semi-educated guess: that your program is getting more scheduled time and can therefore respond quicker to the WM_TIMER message. My guess is that if there was another program consuming more CPU than yours, you might take longer to respond.
Joel Lucsy (jjlucsy@concentric.net)
|
|
|
|
|
I want to capture the packet (that comes to my server application) and display the fields in that packet like source address,destination address e.t.c.
I am using the winsock2 library for my server.
Please help me (if i have declare a struture of TCP,UDP and than capture the packet) with the relevant theory, logic, code or relevant website for achieving my purpose.
Reply me soon
|
|
|
|
|
I want to capture the packet (that comes to my server application) and display the fields in that packet like source address,destination address e.t.c.
I am using the winsock2 library for my server.
Reply me soon
|
|
|
|
|
Hi All
I have an xml which is passed thru a sytlesheet and in the resultant file, two tags IDValue and IDScheme are not properly output.
Could you please help me out !
Thanks
<b>Enclosed - Source XML </b>
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="C:\ExpressPrototypes\Chi Interface Prototype 2\XMLFiles\RegisterPatientResponse.xsl"?>
<gen:RegisterPatientResponse xmlns:gen="http://www.show.scot.nhs.uk/isd/General" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- xsi:schemaLocation="http://www.show.scot.nhs.uk/isd/General CHIRegisterPatientResponse.xsd" -->
<!-- Contains standard patient response header and a patient body which contains the CHI Number -->
<gen:StandardPatientResponseHeader>
<gen:ReturnCode>SUCCESS</gen:ReturnCode>
<gen:ErrorCode>0001</gen:ErrorCode>
<gen:ErrorText/>
</gen:StandardPatientResponseHeader>
<!-- Standard patient response body containing the CHI Number -->
<gen:StandardRegisterPatientResponseBody>
<gen:PatientDetails>
<gen:PatientId>
<gen:IdValue>1601025017</gen:IdValue>
<gen:IdScheme>CHI</gen:IdScheme>
</gen:PatientId>
</gen:PatientDetails>
</gen:StandardRegisterPatientResponseBody>
</gen:RegisterPatientResponse>
<b>Enclosed Source XSL</b>
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gen="http://www.show.scot.nhs.uk/isd/General" xmlns:req="http://www.isoftplc.com/Express/Chi/RegisterPatientResponse" xmlns:hdr="http://www.isoftplc.com/Express/Chi/Header" exclude-result-prefixes="gen hdr">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="*">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="text()|@*"/>
<xsl:template match="gen:RegisterPatientResponse">
<gen:RegisterPatientResponse>
<xsl:apply-templates/>
</gen:RegisterPatientResponse>
</xsl:template>
<xsl:template match="gen:StandardPatientResponseHeader">
<gen:StandardPatientResponseHeader>
<gen:ReturnCode>
<xsl:value-of select="./gen:ReturnCode"/>
</gen:ReturnCode>
<gen:ErrorCode>
<xsl:value-of select="./gen:ErrorCode"/>
</gen:ErrorCode>
<gen:ErrorText>
<xsl:value-of select="./gen:ErrorText"/>
</gen:ErrorText>
</gen:StandardPatientResponseHeader>
</xsl:template>
<xsl:template match="gen:StandardRegisterPatientResponseBody">
<gen:StandardRegisterPatientResponseBody>
<gen:PatientDetails>
<gen:PatientId>
<gen:IdValue>
<xsl:value-of select="./gen:IdValue"/>
</gen:IdValue>
<gen:IdScheme>
<xsl:value-of select="/gen:IdScheme"/>
</gen:IdScheme>
</gen:PatientId>
</gen:PatientDetails>
</gen:StandardRegisterPatientResponseBody>
</xsl:template>
</xsl:stylesheet>
The values IDValue and IDScheme are not properly output
|
|
|
|
|
Hi,
I'm making a program that have a listview that lays on top of another window(different program). I'd like to show the context menu of the other window. I've tried to send a WM_RBUTTONDOWN message and also WM_CONTEXTMENU, but it doesn't work. Can anybody help me?
I hope my question is clear...
-------------------------------
Greetz,
MG
|
|
|
|