|
But i wanted to disable the autostart option programatically... i know how to disable the autostart using Windows's dialogs and the system control panel, but how to code this in C++?
|
|
|
|
|
Theres an article on MSDN about this, click
here (new window)
Dylan Kenneally
London, UK
|
|
|
|
|
Thanks!!!! That's perfect!
|
|
|
|
|
Hi there !
So this is from MSDN, so i think u should try it:
UINT g_uQueryCancelAutoPlay = 0;
BOOL DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
...
default:
if (!g_uQueryCancelAutoPlay)
{
g_uQueryCancelAutoPlay = RegisterWindowMessage(TEXT("QueryCancelAutoPlay"));
}
if (uMsg == g_uQueryCancelAutoPlay)
{
SetWindowLong(hDlg, DWL_MSGRESULT, TRUE);
return 1;
}
}
}
Hope this helps !
Olli
|
|
|
|
|
[ccode]
/*=============================================================================== Sorting a tree using CTreeCtrl::SortChildrenCB() =================================================================================*/CTreeCtrl *myTreeCtrl;static int CALLBACK MyCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort){ // lParamSort contains a pointer to the tree control.The lParam of an item is just its handle. CTreeCtrl *pmyTreeCtrl = (CTreeCtrl*) lParamSort; CString str2 = pmyTreeCtrl->GetItemText((HTREEITEM)lParam2); AfxMessageBox(str2); return 1;}//sorting treesvoid CSMPprojectDlg::SortTreeItem(){ HTREEITEM hRoot = m_TreeCtrl.GetRootItem(); HTREEITEM hNextItem = m_TreeCtrl.GetNextItem(hRoot,TVGN_NEXTVISIBLE); while( hNextItem != NULL ) { m_TreeCtrl.SetItemData(hNextItem,(DWORD)hNextItem); hNextItem = m_TreeCtrl.GetNextItem(hNextItem,TVGN_NEXTVISIBLE); } myTreeCtrl = &m_TreeCtrl; TVSORTCB tvs; tvs.hParent = m_TreeCtrl.GetRootItem(); tvs.lpfnCompare = MyCompareProc; tvs.lParam = (LPARAM)myTreeCtrl; m_TreeCtrl.SortChildrenCB(&tvs); MessageBox("hello");}void CSMPprojectDlg::SortingAtree(){ SortTreeItem();}
//but the messagebox in callback function print empty string... it is suppose to be print whatever i had set ( in my case file information, which are .type_size_date (.txt_231_5/3/02) )to
tv_instruct tree;tree.item.lParam = type_size_date;
[/ccode]
when inserting to tree.
i want to sort by date,by type, and by size like window explore
anyone have the same experience??
|
|
|
|
|
How are you setting items' data with SetItemData ? I suspect here lies the problem.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
this is how i set item data..
HTREEITEM hRoot = m_TreeCtrl.GetRootItem();
HTREEITEM hNextItem = m_TreeCtrl.GetNextItem(hRoot,1);
while( hNextItem != NULL )
{
m_TreeCtrl.SetItemData(hNextItem,(DWORD)hNextItem);
hNextItem = m_TreeCtrl.GetNextItem(hNextItem,1);
}
|
|
|
|
|
hi
how can i read all the data from a Com port without knowing before hand how many Bytes are to be read?
i am using the function:
ReadFile(hCommPort,Buffer,sizeof(Buffer),&nBytesRead);
i only get 4096 Bytes into the buffer but the file i am reading can be 4 times more than that!how can i get it all?would appreciate if anyone can help in any way.
|
|
|
|
|
I never did anything with the COM port functions but normally you call data-retrieving functions several times to retrieve the data in small pieces...
I had a look in the MSDN and the first line in the description of the ReadFile function is:
The ReadFile function reads data from a file, starting at the position indicated by the file pointer.
I didn't test it but i think you can read small pieces until the function reports an EOF.
|
|
|
|
|
The third argument to readfile is how many bytes yopu're trying to read. You're trying to read sizeof(Buffer) bytes. Now, I'm guessing that you've allocated buffer as:
BYTE buffer[4096];
change it and you're sorted.
Signature space for rent. Apply Within.
|
|
|
|
|
Read from the serial port a byte at a time until you get no bytes returned. Don;t forget to configure the COM port to retrun immediately after a read otherwise it will wait for the data and block your thread.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Hi there,
I wrote a simple game by windows GDI functions in MFC dialog based exe project.
But my program has great problem !
It is about flickering images on dialog !
I must show some images on the dialog after getting keys from user !
For drawing pictures on the dialog i must use CDC in OnPaint() ...
So, how could i show my pictures without flickering ?
Plz help me !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
|
Hi Dominik,
Thanks for reply,
But his example was in SDI template ...
How can i use his idea in dialog based program ?
Plz help me
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Sorry for my silly question: What is automation for?
Thanks
|
|
|
|
|
In a nutshell, it's a special interface for a COM object. To be automatable, the object should support the IDispatch interface. You can then automate (call functions, etc.) that object with another program, or a VB script, or what have you.
You can write these interefaces in a speical langauge (IDL I think it's called), and create a type library so that other programs can link to the COM object easier.
Just a fancy addition on top of COM.
No generalization is 100% true.
Not even this one.
|
|
|
|
|
i have a static library built with VC6. internally, it uses STL.
when i try to link that into a VS.Net project (an MFC project, not C# or anything), i get a set of linker errors relating to std::logic_error, std::length_error and std::out_of_range - all unresolved externals.
did MS make changes to these classes ? does this mean any static lib built with VC6 will not work in VC7, if it uses STL ? WTF ?
-c
There ain't no second chance
Against the thing with the forty eyes
|
|
|
|
|
Sure they did a lot of changes to the internals of STL containers as well as some of the interfaces (like the inclusion of standard-compliant allocators.) So one could expect this kind of problems.
That said, maybe the particular problems you have are minor and could be solved without having to recompile the lib. Could you post them in length? (if you please )
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
vhcLib error LNK2001: unresolved external symbol "public: __thiscall std::logic_error::logic_error(class std::logic_error const &)" (??0logic_error@std@@QAE@ABV01@@Z)
vhcLib error LNK2001: unresolved external symbol "public: __thiscall std::logic_error::logic_error(class std::logic_error const &)" (??0logic_error@std@@QAE@ABV01@@Z)
vhcLib error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::out_of_range::out_of_range(class std::basic_string,class std::allocator > const &)" (__imp_??0out_of_range@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z) referenced in function "protected: void __thiscall std::vector >::_Xran(void)const " (?_Xran@?$vector@PAUCFileDataTag@@V?$allocator@PAUCFileDataTag@@@std@@@std@@IBEXXZ)
they're all unresolved externals in STL.
this really pisses me off. i already maintain 7 different VC6 builds of my libraries (a single DLL and then 6 static builds: release and debug of multi DLL, multi and single). i don't have the time to build and maintain another 7.
i guess i could write my own std::queue, std::string, etc..
-c
There ain't no second chance
Against the thing with the forty eyes
|
|
|
|
|
Yup, it is frustrating, but there is little MS can do about it. They can't make STL more compliant while still supporting the old broken STL.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I'm afraid you have no option but to rebuild your lib with VC++7.0. I've tought hard about possible workarounds but alas found none --maybe someone brighter can come up with a solution.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Dear All,
In a dialog-based application, i have an image list (with scrollbar). The images can be displayed in another window
when double click the image in image list. But, in another way, the image
is displayed by a timer function (time-code based) automatically. When a new image is shown in display area, I also want the image list to show same image (It seems that the scrollbar should be also updated automatically).
How should i do?
Thanks in Advance!
chen
xyz
|
|
|
|
|
Help me, I want Set my font for My Menu, how to write it in MFC???
thanks !!!
|
|
|
|
|
As far as I know, there's no other way to achieve this than ownerdrawing the menu, which is no easy task. Look around the net for Ownerdraw menu controls (For one I found ShuiGui Lu's Owner Drawn Menu With Free Color & Font.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Is there a way to remove the 'cancel' button from the property page? I've used the 'CPropertyPage::CancelToClose' method to disable the'cancel' button on the page. Is there a way to remove the 'cancel' button instead of disabling it?
Any help would be much appreciated.
Robert
|
|
|
|