|
Thanks everyone.
I set Visual C++ to use *spaces* when I hit the tab key. This method works great. Thanks!
Kuphryn
|
|
|
|
|
i have a program where i need to read and save .cur files. I figure saving will be done in the serilize function but i dont know how to actually save the info as the .cur format. i figure its just a bitmap with a point(the hot spot) but im not sure. anyone know of any sites that say how to do this? hope that makes sense.
-Raffi
The truth about C++
|
|
|
|
|
|
|
Thanks alot.
-Raffi@School who cant remember his pw.
|
|
|
|
|
Does anyone know of a quick tut on SplitterWnd...?
I've used them once, but can't for the life of me get them to work again.
I'm having kittens here, so if anybody could direct me in the right direction atleast(tutorial) i'll take it from there.
Heres my code
m_wndSplit.CreateStatic(this, 2, 1);
m_wndSplit.CreateView(0, 0, RUNTIME_CLASS(CTheView), CSize(10,10), pContext);
m_wndSplit.CreateView(1, 0, RUNTIME_CLASS(COtherView), CSize(10,10), pContext);
What am i doing wrong...?
The last time i used Splitter it wasn't required to have control over the view(s) so RUNTIME_CLASS(CEditView) was fine. However now i'd like to know, is there a way to create an instance of CView and use that with RUNTIME_CLASS(theView) so I can call it's member funtions...?
I hope I make sense..;P
THANX
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I assume you are creating the splitter windows from within your CFrameWnd derived class. Now I don't see why you would want to create a CView derived object and pass that to the splitter function. Anyway that's not possible. But I am curious as to why you'd want to do that.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Created in CMainFrame OnCreateClient yup...I figured out, or rather fixed them problem...can't say exactly what was causing the views no to show. However it seems that CMainFrame had OnSetFocus() OnCmdMsg() overridded and they were empty, when i removed these functions...the panes magically appeared???
Nish [BusterBoy] wrote:
Now I don't see why you would want to create a CView derived object and pass that to the splitter function
What do you mean...i thought you had to use CView derived classes in splitter windows...?
The classes i'm actually using are CSortListCtrl(found here on CP) but I converted it into a CListView, cuz i thought only views were allowed. And again CTreeview, I need a windows explorer type SDI
Tree on the left, list on the right...
Unless I mis-understood you earlier, i'll ask agin.
I can't do the following..?
CSortListCtrl m_ctlrList;
m_wndSplit.CreateView(0, 1, RUNTIME_CLASS(m_ctrlList), blah...);
Is this because CreateView is creating the instance of CSortListView(or whatever) itself using rtti...?
If so, once i have my panes created, how could i call the derived CView classes member functions...? Like a CListView AddItem()...?
Thanx Nish!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
HockeyDude wrote:
Unless I mis-understood you earlier, i'll ask agin.
I can't do the following..?
//CMainFrameCSortListCtrl m_ctlrList;//OnCreateClientm_wndSplit.CreateView(0, 1, RUNTIME_CLASS(m_ctrlList), blah...);
As far as I know, you cannot do that.
The RUNTIME_CLASS macro takes a class name and not an instance of the class.
Regards
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Thanx again!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
It's cool Nish...I think i figured it out...
However I'm cursious.
Does the CreateView function actually create and instantiate the CView derived class itself using rtti..?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
HockeyDude wrote:
Does the CreateView function actually create and instantiate the CView derived class itself using rtti..?
Yes. It does exactly that. It calls the CreateObject function to actually create an object of your view class
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Cool..thanx again!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
what can i do to allow my program to run only in 1 instance (if i run my program, i cannot open the similar program without closing the other 1.)
something similar to windows disk defragmenter. i am currently using MDI for my project. hope experts out here can help mi
|
|
|
|
|
No expert i'm afraid.
However msdn states
hPrevInstance
Handle to the previous instance of the application. For a Win32-based application, this parameter is always NULL.
If you need to detect whether another instance already exists, create a uniquely named mutex using theCreateMutex function. CreateMutex will succeed even if the mutex already exists, but theGetLastError function will return ERROR_ALREADY_EXISTS. This indicates that another instance of your application exists, because it created the mutex first.
HTH
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
For a great article on this subject, go to:
http://www.pgh.net/~newcomer/nomultiples.htm
Jim
|
|
|
|
|
I only browsed through it quickly, but my impression was that CreateMutex won't work as solid as you would think. I totally didn't even think of multitasking.
Thats for the tip...
I'll be sure to read up on it, so as not to offer insufficient advice.
Ah well there loss not mine!
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Use this class:-
class CLimitSingleInstance
{
protected:
DWORD m_dwLastError;
HANDLE m_hMutex;
public:
CLimitSingleInstance(TCHAR *strMutexName)
{
m_hMutex = CreateMutex(NULL, FALSE, strMutexName);
m_dwLastError = GetLastError();
}
~CLimitSingleInstance()
{
if (m_hMutex)
{
CloseHandle(m_hMutex);
m_hMutex = NULL;
}
}
BOOL IsAnotherInstanceRunning()
{
return (ERROR_ALREADY_EXISTS == m_dwLastError);
}
};
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
While I was coding a fileparser I stubled upon something _very_ weird. My file started like this (in hex):
020102416E6369656E74277320506C6564676501536869656C64730152616C034F72740354616C012B353025
20456E68616E63656420446566656E736504436F6C6420526573697374202B34332504466972652052657369
7374202B343825044C696768746E696E6720526573697374202B34382504506F69736F6E2052657369737420
2B343825043130252044616D61676520476F657320546F204D616E6100426C61636B01436C7562730248616D Try pasting this into a new file using a hexeditor, save it, and then open it in Notepad. If you have chinese character-set installed it will for some reason show up in chinese. Why?! This is mostly plain english... I've tested this lots of times, and there seems to be no way around it, except uninstalling the chinese character set!
Sprudling
PS! I'm using WindowsXP Pro
|
|
|
|
|
Have you checked for virii lately ?
|
|
|
|
|
As a matter of fact I just did earlier today. Using NAV 2002 with the most up to date virus definitions, and no virus found.
I really think there is a logical explanation to this.
Sprudling
|
|
|
|
|
You are probably right. I was grasping at straws.
|
|
|
|
|
Check your Notepad default font settings
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
That was of course the first thing I checked and it's the WinXP default courier. It's only that file (and others starting with the same numbers in hex) that shows up in chinese. Have any of you even tested yet?
Sprudling
|
|
|
|
|
What is the file extension you are using?
The way I understand notepad is that if the extension is TXT it simply reads the file as ASCII and dumps it on the multi line edit control which is it's main control.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|