|
If using the CHtmlView, you need to Navigate to "about:blank" first, then wrench around the document. Or, my personal favorite, go to QHTM[^] and use his control.
Joel Lucsy (jjlucsy@concentric.net)
|
|
|
|
|
I'll try that "about:blank". Sounds like that's what I need. And as to wrenching around the document, is that the way to do it?
CHtmlView::GetDocument() -> IDispatch
IDispatch->QueryInterface -> IHtmlDocument3
IHtmlDocument3->documentElement -> IHtmlElement
set IHtmlElement->innerHTML
Seems convoluted.
On the other hand, QHTM looks like it solves my problem quite nicely. It will even let me do my internal navigation without having to host a custom pluggable protocol for IE...
Thanks!
J
May the bear never have cause to eat you.
|
|
|
|
|
No, you don't need to wrench to hard. I have some code that does it, but it boils down to getting the IHTMLDocument2 interface, then calling the Write method. Thats about it. My code has some other useful functions like setting the background color, overriding the opening of new windows, and so forth, but to just display a document thats all you need to do.
Joel Lucsy
|
|
|
|
|
Perfect. I knew there would be an easier way. Of course having to create a safearray for a single string seems a little extreme, but I'll give it a go.
Thanks for your help!
J
May the bear never have cause to eat you.
|
|
|
|
|
|
Yes, QHTM looks quite handy. I'm undecided as of yet whether or not I need the full IE control...
I saw the XHTMLStatic control, but it's too lite for me. I need pretty much full HTML compliance.
J
May the bear never have cause to eat you.
|
|
|
|
|
how can i set a new Registry Key with a binary or a DWORD value? I have set a String Value for a Registry Key. But I could not set for a Binary or DWORD.
Pl. give me an example coding.
vijay
|
|
|
|
|
BYTE Buffer[256] = {1, 2, 3, 4, 5, 6};
LONG nRetVal = ERROR_SUCCESS;
HKEY hKey = 0;
nRetVal = ::RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\MyCompanyName"), 0, KEY_ALL_ACCESS, &hKey);
if(nRetVal != ERROR_SUCCESS)
return ::RegSetValueEx(hKey, _T("My Binary Field"), 0, REG_BINARY, Buffer, sizeof(Buffer)/ sizeof(BYTE));
return nRetVal;
|
|
|
|
|
Do you know any function to return if the app is running from a server or from the local machine ??
Thanks,
Cris.
|
|
|
|
|
what kind of application, environment, technology?
In short what info do you have, and what exactly do you want to know?
|
|
|
|
|
Is a Windows MFC Aplication, dialog based. I want to know when the app is running from another machine (server in a LAN) or from a local machine (the app located in the same machine that it is running).
Then, I need to make my app for don't run from a server, only from the local machine. Ok ??
Any idea ??
[]'s
Cris.
|
|
|
|
|
Write a DCOM app for each server you want to check and use the API I indicated yesterday?
|
|
|
|
|
If I understand correctly, you want to know whether the location of the application executable is on a network drive, or a local drive (the app wouldnt 'run' on the other machine, it is just loaded into memory on your local machine)? If this is the case then you can use GetCurrentDirectory function to retrieve the directory which the application is started in, and then GetDriveType to determine if its a network drive
|
|
|
|
|
Ok, anonymous !! This is what I was finding, the GetDriveType function !!
Thank you very much,
Cris.
|
|
|
|
|
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
|
|
|
|
|
|