|
I believe that that style was not introduced/implemented back in Win98. So, if you really need right-aligned text, you'll need to implement an owner-drawn list box and draw the strings right-aligned yourself.
onwards and upwards...
|
|
|
|
|
|
how to find the process name if i know the process ID. Is there any straight forward function? or pliz forward me a link
|
|
|
|
|
Try this:
char szProcessName[MAX_PATH];
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,FALSE, processID);
if (NULL != hProcess )
{
HMODULE hMod;
DWORD cbNeeded;
if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod), &cbNeeded) )
{
GetModuleBaseName( hProcess, hMod, szProcessName, sizeof(szProcessName) );
}
}
Still Alone in this beautiful world
My Articles
|
|
|
|
|
Hello Friends,
What's is the main advantage of having virutal destructors? Why don't we have virtual constructor?
Thanks in advance.
Neelesh K J Jain.
|
|
|
|
|
That's a good question .
In fact if we don't need virtual constructor, it's because when you instanciate your pointer, you ALWAYS know what class you instanciate. So take the example of one base class (CBase) and one child class (CChild). If you have an uninstancied pointer to the base class:
CBase* pPointer;
If you instanciate it into a child class:
pPointer = new CChild;
the compiler knows exactly that you want to create a child class (first the compiler creates a child class and then it stores the pointer into the uninstancied pointer).
So know you've done a lot of things with this pointer and you want to destroy it:
delete pPointer;
The compiler just knows that the pointer is from type CBase (that's how it has been declared) without knowing that it has been instancied as a child class. So, in this case your destructor must be virtual so that the compiler will call the destructor of your child class and not from the base class.
Hope this helps
|
|
|
|
|
I like this question. The other posting did a good job of explaining why the virtual destructor is needed. The reason you don't need a virtual constructor is that you are specifically telling the compiler what you want to instantiate.
You write
int i = 10;
CBase* pPointer;
pPointer = new CChild(i);
The concept of virtual functions is also described as dynamic run time binding. So the idea is that you call a function on the fully instantiated object and the system is smart enough to realize that since a function is virtual, the child class version of the function is called first. Then the child class can execute it's own code and may or may not ivoke the base class version of the function as well.
So virtual functions don't make sense during the construction process. The child class has to call the constructor for the base class from within it's own constructor. Once the construction of the class is complete, you can use the base class pointer to call virtual functions. If you tried to call any virtual functions from either of the constructors, I'm not sure what would really happen. I wouldn't recommend trying this as it really makes no sense. Seems like it would be an undefined operation that may or may not cause a crash.
Shawn
|
|
|
|
|
Hello,
I'm very new to programming but have learned allot over the past few months. Here is my issue.
I have a program that I'm working on. It's written in C not C++ and it is GDI based. I'm using MS Visual Studio 2003. I have the ability to edit everything that is in the .rc file under the project, dialogs, the menus, and ext. What I don't have the ability to edit is the items below the menu such as the pens and other visual designs that are contained within the main window of the program. This is not like VB or C# where you can just edit the main window from the IDE. I have no ability whatsoever to change the overall visual design or feel of the main body of the program other than manual editing of the code, for example:
// draw check box
// We select the brown pen anyway to make sure we have a valid value
// for hOldPen for later calls to SelectObject()
hOldPen = SelectObject( hDC, lpe->hBlackPen );
if ( !lpe->tracks[i].bData )
{
pts[0].x = pts[3].x = pts[3].x = ((hx[1]+1)/2 - 4) - lpe->dx;
pts[1].x = pts[2].x = pts[0].x + 12;
pts[0].y = pts[1].y = pts[4].y = rc.top + 1;
pts[2].y = pts[3].y = rc.top + 13;
Polyline( hDC, pts, 5 );
}
if ( lpe->tracks[i].bChecked && !lpe->tracks[i].bData )
{
SelectObject( hDC, lpe->hBlackPen );
pts[0].x += 3;
pts[0].y += 3;
pts[1].x = pts[0].x + 2;
pts[1].y = pts[0].y + 3;
pts[2].x = pts[1].x + 8;
pts[2].y = pts[1].y - 8;
Polyline( hDC, pts, 4 );
pts[0].x += 1;
pts[1].x = pts[0].x + 2;
pts[1].y = pts[0].y + 3;
pts[2].x = pts[1].x + 8;
pts[2].y = pts[1].y - 8;
Polyline( hDC, pts, 4 );
}
SelectObject( hDC, hOldPen );
}
SetBkMode( hDC, oldBkMode );
SelectObject( hDC, hOldFont );
EndPaint( hWnd, &p );
}
The code above is for just displaying a simple checkbox for selecting items displayed within the main window. I have been able to modify the code to an extend but it takes allot off time and pulling out of hair;) Really what I would like to do is be able to change these things at least as easy as I can make changes in the .rc file under the MSVC resource editor. There has to be an easier way to make changes or additions besides what I'm now doing. Unfortionally, I'm not the original author of this program so I don't know what editor they used to compose the GUI.
Better yet, I would like to spice up my main window from the generic look it has now to something better as well as be able to add to it. Are there any libraries out there that would easily integrate into this GDI application? I really like the new Office 2003 look and feel.
I would very much appreciate any help I can get and thank everyone in advance for your time in helping me.
Jamie
|
|
|
|
|
Hello Friends,
I am displaying a Progress control in the statusbar of my application.Whenever I switch to another window using Alt+Tab and come back to my application, the progress control is not refreshing and seems to struck in its position eventhough in the background the application is in progress. This problems arises only if I am having XP operating system, if I have Win2000 then the progress control is refreshing properly and the user can see the progress.
So please help me regarding the above mentioned problem how can I refresh the progress bar in any operating system.
thanks in advance.
Neelesh K J Jain.
|
|
|
|
|
http://www.codeproject.com/miscctrl/CSkinProgress.asp?df=100&forumid=15586&mpp=50&select=885997#xx885997xx
Kochise
In Code we trust !
|
|
|
|
|
Hi all,
Simple function (cut down to not include all the other crap.
I have #included the winsock.h and included the wsock32.lib.
int GetIPAddresses()
{
char shostname[255];
int e = 0;
e=gethostname(shostname, sizeof(shostname));
struct hostent *pdata = ::gethostbyname(ashostname);
}
On compiling I get this error :
error C2143: syntax error : missing ';' before 'type'
Does anyone know what that is?
[EDIT]This is in C and not C++. I forgot to mention that.[/EDIT]
Cheers,
"If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)
|
|
|
|
|
Have you tried using the winsock2 stuff instead?
winsock2.h
and
ws2.lib
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Hi Ant,
Yes I have, and still the same error.
Cheers,
"If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)
|
|
|
|
|
I'm using a CRichEditView derived class for my view. When I drag a file from explorer over it's view and drop it I want to open the file if it is a text file otherwise tell the user it won't work. The default implementation is to draw a box representing the file.
What message should I be catching and any tips??
ed
|
|
|
|
|
Fount it!
ed
The absence of evidence is not evidence of absence.
|
|
|
|
|
im tasked with updating our suite of MFC apps (mostly dialog based stuff, one mdi app) and am looking into updating the look and feel. Specifically want a well documented gui/controls/widget library with reszeable customizeable toolbars, docking, nice grid, print preview, nice control library. Anyone have any recommendations ? or ones to avoid ?
thnx.
|
|
|
|
|
Dundas is pretty good but it doesn't look like they are advancing it now. Prof-UI is really good too. I use them together for the most part.
Stingray used to work real good but they are pretty expensive and not quite as easy.
ed
The absence of evidence is not evidence of absence.
|
|
|
|
|
Hi all:
How can I retrieve the FDT for specific folder!!
Thanks
|
|
|
|
|
again ?
I think that we don't know how to do that.
heck, I tried seaching MSDN, and I'm not even sure what to look for ?
What exactly are you trying to do ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Sorry! If this frequent appearing message bothering you!
I'm exhausted with file ordering methods!It seems the previous method(firt copied file list ahead) simply works but to a extent where I can't accept It's stableness. So I turn to FDT. I just used WinHex(a tool) to check the folder that contain many music files. When I get to that folder's cluster, the contents(the file name contained in that folder) at that cluster for which WinHex display is the exact order that appearing after the execution of DOS command "dir".
So I try my best to manipulate FDT to achieve my goal!It's probably my last resort!
Oh,BTW I should make its application clear. What I'm trying to do is specify the music files playing order for MP3 player!Its order is correspondent to the order appear after "dir"!So...it all begin!!
|
|
|
|
|
I still don't understand why the order given by "dir" is so important to you, and not the order given by FindFirstFile/FindNextFile ?
Why don't you let the user specify in what order the files will be played ( like all other mp3 players in existence ) ?
One other way would be to execute the "dir" command and catch its output, and parse it for the filenames.
me think that going deep in the filesystem to find the "File Directory Table" just to have an ordered file list is WAY overkill.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
All just because the music files playing order for the most MP3 player is rely on the order appear after "dir"!But the command "dir" itself has nothing to do with it!
You're right going deep into the filesystem is WAY(is this word a adj or a acronym, just out of language learning prupose) overkill!
I just found that the reason for the unstableness of the previous method is if you rename a file it will not change it's order unless it contain space or long name! Hope that fact can save me, working on it currently!
Thanks for your patience anyway!I appreciate it!
|
|
|
|
|
kwib799 wrote:
All just because the music files playing order for the most MP3 player is rely on the order appear after "dir"!But the command "dir" itself has nothing to do with it!
Most ( if not all ) mp3 players rely on internal playlists; not actually what is on disk; if a file changes between execution of the mp3 player, the playlist entry will be marked as "bad" when the user will try to play the file. There are multiple ways of handling this, for example, iTunes will not see bad files until the user access the file ( either playing, editing the tags, ... ), it makes loading the application faster , and will ask the user to act up to either remove the internal entry or find the actual file. on other software that I use, Traktor will scan the disk to check the consistensy of its database, load time of the application can take a long time, but all "bad" files will be reported/marked and the user can see and fix them without having to "guess" which one changed.
(edit)
( the above is partially true ... too early to think straight ... )
I think that most mp3 players ( iTunes, WMP, Winamp, ... ) will use metadata tags internally, either ID3 tags for mp3 files or some other formats ( for wma, aac, ogg, ... ).
kwib799 wrote:
I just found that the reason for the unstableness of the previous method is if you rename a file it will not change it's order unless it contain space or long name! Hope that fact can save me, working on it currently!
huh ? if I rename a file and do a dir it will put the rename in its good alphabetical place.
I you always load the file list from what is in the directory, renaming a file will change its order and be shown.
If you rename the file externally while your program is running, then, I agree, your player will not be able to play the file, because its internal list will not match its own file name with what is on disk.
If you need to "watch" filess in a directory, there is a API that will notify you when that happens.
( I think the API is FindFirstChangeNotification and related functions ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I need to make a program that uses fxxxx (fopen, ftell, fseek, fread, etc...) functions to support >2gb files. How would I do that? I see _fseeki64.c and _ftelli64.c in crt\src\, but can't figure out how to use those functions in my program (no matter what I do, I get an unresolved external symbol error). A Google search on those functions turns up virtually nothing
|
|
|
|
|
I think you'll need to move to the Win32 API functions CreateFile, SetFilePointer, and ReadFile... You can look these up in the Docs.
onwards and upwards...
|
|
|
|