|
Virtek wrote: HINSTANCE h1 = LoadLibrary("Foo.dll");
HINSTANCE h2 = LoadLibrary("Foo.dll");
bool IsSame = (h1 == h2);
You're seeing the correct behavior, that's how DLLs work. The second LoadLibrary() sees that the DLL is already loaded, so it just increments the reference count.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Hi,
I need to find all files in a certain directory that are in the format of: file.001, file.002, etc (the numbers in the file extensions can go up to infinity...).
I am using the functions FindFile and FindNextFile to do this (my code is below). The problem is that in the same directory there might also be files named file.x or file.y (for example) which I don't need to find.
I only need the files with the number extensions.
Is there a way to do this?
this is my code:
sSearchPath.Format("file.*");
BOOL bWorking = f.FindFile(sSearchPath);
while (bWorking)
{
bWorking = f.FindNextFile();
CString strFileName = f.GetFileName();
}
Thanks
|
|
|
|
|
I dont know if this code work with but this what I used
int i=0;
WIN32_FIND_DATA info;
HANDLE hp;
sprintf(fileFound, "%s\\*.tga", folderPath);
hp = FindFirstFile(fileFound, &info);
if(hp== INVALID_HANDLE_VALUE)
return;
do
{
sprintf(fileFound,"%s\\%s", folderPath, info.cFileName);
// DeleteFile(fileFound);
i++;
}while(FindNextFile(hp, &info));
FindClose(hp);
ShowMessage(i);
|
|
|
|
|
I don't understand, are u looking for all files that have a .tga extension?
|
|
|
|
|
|
Thanks for your help - but that's not what I need...
I need to look for a files that have the same file name each time, but have different extensions.
For Example, in my directory there are the files:
file.001
file.002
file.x
file.y
so, I don't need to find the files file.x or file.y. I only need to find the files that have an extension that consists of numbers.
The problem is that when I search for files in the format: "file.*", it finds the files named file.x and file.y which I don't need.
|
|
|
|
|
ok
for(.............etc.)
sprintf(fileFound, "%s\\file.00%.1d
",ARRAYOFCONST((folderPath,i)) );
now you can search for ectintions
from 001 to 009
-- modified at 9:20 Sunday 16th April, 2006
|
|
|
|
|
yes - but I don't know what the maximum number the extension could have. There could be a file named file.9999 for instance..
so I can't search until infinity. That's my problem.
Maybe there is a way to check if the extension contains only numbers or something like that. Do you know?
|
|
|
|
|
I dont remember the function name but try this
sSearchPath.Format("file.*");
BOOL bWorking = f.FindFile(sSearchPath);
int j = 0, i++;
while (bWorking)
{
CString strFileEx = ExtractFileExt(f.GetFileName());
while(strFileEx [j] != '\0' )
{
if(!((int)strFileEx [j] >= (int)'0' && (int)strFileEx [j]<='9'))
i++;
}
if(i>0)
//do what you want to do
bWorking = f.FindNextFile();
}
-- modified at 9:57 Sunday 16th April, 2006
|
|
|
|
|
Thanks!
But what is the function "ExtractFileExt"? my code doesn't recognise it. do I need an include for it or something?
|
|
|
|
|
Why not just use PathFindExtension() ?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
SWDevil wrote: Maybe there is a way to check if the extension contains only numbers or something like that. Do you know?
Yes, it's called isdigit() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
For each file found, including file.x and file.y, simply check the extension to see if it is all digits or not.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
what you can do is determine the extension of the file using GetFileName and GetFileTitle. Then for each charcter in extension check if its a digit using isDigit function. If all the characters in extension are digit then keep file else move to next file.
-Saurabh
|
|
|
|
|
|
hi
I just want to know how could I send a save command to another program like notebad from my program.instade of clicking save from file menu
|
|
|
|
|
|
Hi shortwave,
You can use findwindow for get hwnd from application and use
sendmessage(hwndapplication,wm_command,idmenu(item),handlemenu);
|
|
|
|
|
I am using a read-only edit control in MFC.
New text is added to the end of the edit text ).
How can I tell it to scroll as far down as possible automatically so that
the latest text is always visible?
can anyone help me
naz
|
|
|
|
|
You can tell the control to scroll to the last line with code something like this:
m_EditControl.LineScroll(m_EditControl.GetLineCount());
Steve
|
|
|
|
|
Hi all,
Where can I find code snip of displaying a preview of my web cam using direct show?
I know how to do it using VFW(Video For Windows)...
Thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hello All !
In win32,I want to get name and icon of a application and
display it in ListBox.(this likes when choose tab Application of TaskManager program when press Ctrl+Alt+Del).
who know about this problem,please help me.
Thanks.
|
|
|
|
|
|
|
I'm developing an app which has to read binary files. The data in these files can be stored as various sizes, 1-byte 2-byte 4-byte and 8-byte. So when reading the data I need to read it as char short int and long. This is not really the problem, but reading the correct byte order is. At the begining of the file there is a flag to indicate whether the following data will be using Little-Endian or Big-Endian method.
I'm not sure how to deal with this. Could somebody please point me towards a tutorial/article which better explains all this and demonstrates how to deal with the various encodings.
Thankyou
|
|
|
|