|
Try to Use
GetLBTextLen
GetLBText
GetItemData is a different function..check out MSDN.
|
|
|
|
|
Hi..All
i am using a Bitmap in a CBrush to display the pattern in a rectangular box at many places in the drawing of my vc++ application..
the problem is that on certain plotters the pattern is not displayed at all
although it is coming and very good in normal view and print preview.
and on some plotters it just display the crosses all over the rectangle.
and some time the pattern is displayed but it is so close that whole rectangle color becomes black...
Does any body have any idea why...
That would be very nice of him.
Thanks
Muhammad Kamran
Sofware Engineer.
|
|
|
|
|
Some vector based devices do not support that kind of drawing. Try calling GetDeviceCaps(DT_PLOTTER) when in print mode, and if it is true, don't draw using the brush. Typically, vector devices don't support the more advanced printing, like raster devices.
onwards and upwards...
|
|
|
|
|
Hi,
I am planning to develop a tool. It needs to work on a folder of size 2 GB. First it needs to remove the read only attribute for all the files in the folder. Then a third party tool will do some more processing and then my tools needs to delete all the files. This tools needs to work on Win2K. Presently i am using attrib and del dos commands. it takes hell lot of time to dothis task. I would like to develop something at the NTFS level to do this. Any pointers, samples will be of alot of help.
Regards,
Cutti
|
|
|
|
|
Unless I've misunderstood, couldn't you just use the Win32 API or MFC to change file attributes and delete files? CFile provides methods GetStatus() , SetStatus() and Remove() that may fit the bill.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Yes, something like:
void SetFilesToNotReadonly(LPCSTR cpFileDir)
{
CString cFileName;
WIN32_FIND_DATA sFD;
CString cFileSpec = CString(cpFileDir) + CString("*.*");
HANDLE hFind = FindFirstFile((LPCSTR)cFileSpec,&sFD);
if (hFind != INVALID_HANDLE_VALUE)
{
if (!(sFD.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
cFileName = CString(cpFileDir) + sFD.cFileName;
SetFileAttributes(cFileName, sFF.dwFileAttributes & (~FILE_ATTRIBUTE_READONLY));
}
while (FindNextFile(hFind,&sFD))
{
if (!(sFD.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
cFileName = CString(cpFileDir) + sFD.cFileName;
SetFileAttributes(cFileName, sFF.dwFileAttributes & (~FILE_ATTRIBUTE_READONLY));
}
}
FindClose(hFind);
}
}
onwards and upwards...
|
|
|
|
|
Hello,
how can i start another app from my application? After this i like to call the F4 Button?
Thanks in advance, Mark
|
|
|
|
|
ShellExecute() to start the other exe. To send a keystroke you might SendMessage(WM_KEYDOWN, ...) to the other application.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The simplest way is to use ShellExecute() .
ShellExecute(NULL, NULL, _T("myprog.exe"), NULL, SW_SHOWNORMAL); Look at the docs on ShellExecute() to find out what the parameters do and how to use them. To find out whether it is successful or not, ShellExecute() returns a value >32 if it is successful, and <=32 if it is not.
Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
macmac38 wrote:
how can i start another app from my application?
BOOL CreateProcess(
LPCTSTR lpApplicationName,
LPTSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCTSTR lpCurrentDirectory,
LPSTARTUPINFO lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation
);
macmac38 wrote:
After this i like to call the F4 Button?
You want to call the F4 button? I'm not sure what you mean... You can kill the process using the TerminateProcess function (you got the handle from CreateProcess). If you want to simulate a press to F4 you can use the SendInput or keybd_event functions.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Yep, i can call the .exe now when i press a button in my app. What i like to do is to simulate the pressing of F4 after this.
Because this starts a macro in the opened .exe.
I cannot understand the help for these functions you gave me and do not know which code to use for F4(Hardwareadress, number..???)
Do u have a code snip?
Thanks, Mark
|
|
|
|
|
SendMessage(wndOfStartedApp, WM_KEYDOWN, VK_F4, 0);
The first parameter is the HWND of the app you just started.
Instead of WM_KEYDOWN you might also try WM_KEYUP.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
mmh, i use NULL for HWND when i start the app. Nothing happens..
Thanks, Mark
|
|
|
|
|
It is normal:
the HWND defines which window will receive the message, then if you send the KeyPress to a null window...
you should start your app, then find the window of that app and after that send the message there...
I think that you can also do it better, and in order to do so, you should take a look at CreateProcess(...).
hope this helps.
|
|
|
|
|
But how can i find the window of that app? It is a commercial one. By the way i think i have to wait till the app is up before i send the message there?
Thanks, Mark
|
|
|
|
|
If you launch it by using the CreateProcess api, one of the parameters is a PROCESS_INFORMATION structure. This gets filled in with the THREAD HANDLE of the primary thread for the newly lauched app. After the CreateProcess call returns, wait for the app to initialize by calling WaitForInputIdle(). When this returns, then you should be able to simulate a keystroke with the PostThreadMessage api, passing the new app's main thread handle as the parameter.
Good Luck!
onwards and upwards...
|
|
|
|
|
Hi.
Does anyone know if there is a DirectX application wizard for use with the VC++ .NET version.
I am looking for something similar to the app wizard that is available for use under VC++ 6 ?.
Thanks.
James
|
|
|
|
|
;PDear All,
Is there any API which may simulate Deltree command.
I am developing a application for Windows 2000/NT/XP in which i want to remove all contents of a given folder .
Or any alternate way to achieve the same ?
Thanks
Rohit
|
|
|
|
|
Rohit Divas wrote:
Or any alternate way to achieve the same ?
Yes. You'll have to recursively go through the folders, delete each file, and then finally delete the folder. Of course, if a folder contains subfolders, then you'll need to go through that folder and delete all the files and subfolders in it etc., hence the recurson.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
try this:
#include <string><br />
#include <iostream><br />
<br />
#include <conio.h><br />
<br />
<br />
int DeleteDirectory(const std::string &refcstrRootDirectory)<br />
{<br />
std::string strFilePath;
std::string strPattern;
HANDLE hFile;
WIN32_FIND_DATA FileInformation;
<br />
<br />
strPattern = refcstrRootDirectory + "\*.*";<br />
hFile = ::FindFirstFile(strPattern.c_str(), &FileInformation);<br />
if(hFile != INVALID_HANDLE_VALUE)<br />
{<br />
do<br />
{<br />
if(FileInformation.cFileName[0] != '.')<br />
{<br />
strFilePath.erase();<br />
strFilePath = refcstrRootDirectory + "\" + FileInformation.cFileName;<br />
<br />
if(FileInformation.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)<br />
{<br />
// Delete subdirectory<br />
int iRC = DeleteDirectory(strFilePath);<br />
if(iRC)<br />
return iRC;<br />
}<br />
else<br />
{<br />
// Set file attributes<br />
if(::SetFileAttributes(strFilePath.c_str(),<br />
FILE_ATTRIBUTE_NORMAL) == FALSE)<br />
return ::GetLastError();<br />
<br />
// Delete file<br />
if(:eleteFile(strFilePath.c_str()) == FALSE)<br />
return ::GetLastError();<br />
}<br />
}<br />
} while(::FindNextFile(hFile, &FileInformation) == TRUE);<br />
<br />
// Close handle<br />
::FindClose(hFile);<br />
<br />
DWORD dwError = ::GetLastError();<br />
if(dwError != ERROR_NO_MORE_FILES)<br />
return dwError;<br />
else<br />
{<br />
// Set directory attributes<br />
if(::SetFileAttributes(refcstrRootDirectory.c_str(),<br />
FILE_ATTRIBUTE_NORMAL) == FALSE)<br />
return ::GetLastError();<br />
<br />
// Delete directory<br />
if(::RemoveDirectory(refcstrRootDirectory.c_str()) == FALSE)<br />
return ::GetLastError();<br />
}<br />
}<br />
<br />
return 0;<br />
}<br />
<br />
<br />
int main()<br />
{<br />
std::string strDirectoryToDelete = "c:mydir";<br />
<br />
// Delete 'c:mydir' and its subdirectories<br />
int iRC = DeleteDirectory(strDirectoryToDelete);<br />
if(iRC)<br />
{<br />
std::cout << "Error " << iRC << endl;<br />
return -1;<br />
}<br />
<br />
// Wait for keystroke<br />
_getch();<br />
<br />
return 0;<br />
}
|
|
|
|
|
SHFileOperation() will help you!
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
Rickard Andersson18 wrote:
SHFileOperation()
I thought of that, but does SHFileOperation() do a recursive delete on an nonempty folder?
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
<edit> Problem Sorted </edit>
Regards,
Brian Dela
|
|
|
|
|
Hi !
Your question is not clear... Is this an Installshield question ? I do not understand what you mean with I have Launch Conditions in place that determine if the resgistry entry is there but how to I get the folder to install in the path indicated in the registry entry?. In Installshield, I seem to remember that you can use VB registry commands to achieve that.
What I suggest you is to use Innosetup, since it will take you approximatively 5 minutes to achieve that
~RaGE();
|
|
|
|
|
Rage wrote:
Is this an Installshield question ?
I created a SetupProject through Visual Studio .NET 2003 so it's INstallShield based.
Regards,
Brian Dela
|
|
|
|