|
hello Friends
i m using OPENFILENAME for opening files from dialog but if i change view to thumbnail and then open again dialog then view goes to list view.It does not stays the same thumbnail view.Is any parameter for tht to keep staying in same view?
thanks & Regards
Yogesh
|
|
|
|
|
I am not sure if it can be done using some documented function. This article[^] describes a trick to do it.
-Saurabh
|
|
|
|
|
Thanks for ur reply Sourabh but I didnt get any Idea.The link u provided me is using MFC.Do u know any other way to hadle this?
|
|
|
|
|
Well, even though article is using MFC the you can use the idea to convert to code to Win32. The article uses GetParent, GetDlgItem and SendMessage functions to set the view. What is it that you don't undertand in the article. Check the code for CFileDlgEx::OnFileNameChange in the FileDlgEx.cpp file.
-Saurabh
|
|
|
|
|
Hello,
I want to charts using excel through vc++. I have included excel type library xl5en32.h but in these files _application class or _worksheet class doesnt exist . But the example that i have read of automation from codeproject or any other site use _application class for automation.
How should i go about in writing charts in vc++ with xl5en32.h file
Pritha
|
|
|
|
|
you have to include the right files. Check whether some dll or tlb are missed.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hello,
Thank you for your reply
but which dll or tlb files to include.
I have included the excel type library what else should i include.
Pritha
|
|
|
|
|
Check every "#include" or "#import" of the sample.
I have a sample where this useful code could be found
#pragma message ("Make sure you go to Tools.Options.Directories and add the paths to mso97.dll and vbeext1.olb. Mso97.dll will usually be in c:\\\"Program Files\"\\\"Microsoft Office\"\\Office, and vbeext1.olb will be in c:\\\"Program Files\"\\\"Common Files\"\\\"Microsoft Shared\"\\VBA")
#import "mso9.dll" no_namespace rename("DocumentProperties", "DocumentPropertiesXL")
#import "vbe6ext.olb" no_namespace
#import "excel9.olb" rename("DialogBox", "DialogBoxXL") rename("RGB", "RBGXL") rename("DocumentProperties", "DocumentPropertiesXL") no_dual_interfaces
or this looks quiet fine: BasicExcel - A Class to Read and Write to Microsoft Excel[^]
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi All,
I am writing a Application where a UI thread has to fill a list box control .
Steps Done By me:
1.Created a Dialog Bases application with a list bOx and button(MyDlg.cpp).
2.Created a thread class(MyUIThread.cpp) and a controlling function(MyThreadhandler).
3.When i click the OK Button in the dialog i post a message and create the thread and in the Thread controlling fucntion i have to fill the ListBox.
4.Since the thread is in a different Class i am not able to get the member variable of the listbox in the thread controlling function(MyUIThread.cpp) and fill the List Box.
Can u tell me how will i get the member variable from the dialog class to the thread class.
Kindly Help me out here....
Thanks,
Hari
modified on Tuesday, September 22, 2009 12:30 AM
|
|
|
|
|
You can always pass the handle of the list box to the other class using methods.
Once you get the handle, you can create an object using the FromHandle[^] static method.
However, it is not a good idea to access controls from a thread other than the UI thread that owns the control.
The worker thread that you have must send the LB_ADDSTRING Message[^] to the UI thread when it wants to add a string to the list box.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks for the quick reply!!!!
The static method u told returns a window pointer and how can a add string to the list box with the window pointer !!!!!
I have used CWnd::GetDlgItem to get the ListBox handle is that OK or should i do something else..
Can u tell me how to use LB_ADDSTRNG Message if Possible..
Thanks,
Hari
|
|
|
|
|
SendMessage(GetDlgItem(IDC_LIST1)->m_hWnd, LB_ADDSTRING, 0, _T("String to be Added"));
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
When i use GetDlgItem(IDC_LIST1)->m_hWnd it throws an assertion and m_hWnd is null ..... ASSERT(::IsWindow(m_hWnd));
Please tell me how to solve this problem...
Brief Steps to what i did in the program:
1.Derive a class from Cwinthread and add a thread controlling function
2.CDlg::OnBnOK
{
Create a UI thread;
Post a message to Thread Controlling fucntion.
}
3.In Thread controlling function Fill the List Box.
4. Here i am getting m_hwnd as NUll.
|
|
|
|
|
hraman1987 wrote: 3.In Thread controlling function Fill the List Box.
What part of "Do not access UI controls from any thread other than the one that owns them" are you not getting? Please read this before continuing.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
«_Superman_» wrote: SendMessage(GetDlgItem(IDC_LIST1)->m_hWnd, LB_ADDSTRING, 0, _T("String to be Added"));
This should be posting the message to the list control's parent, not sending the message to the list control itself.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
Microsoft manages to pass on API names to their DLL's without the customary C or CPP Name Decorations. How can I do the same with my API's
Regards,
Bram van Kampen
|
|
|
|
|
Hi,
C++ does decorate names (function name mangling) and C does not.
IIRC there is a way to avoid it in a cpp file by using extern "C" { ... } .
I suggest you look that up in the documentation.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
What I do is use extern "C" {} around the functions I want to export and then use a .def file. (One reason I use a .def file is to control the ordinals of the exported functions which is critical when adding to a DLL that you or third parties will use without relinking. MFC does the same thing with decorated functions for the same reason, though without the extern "C" keyword.)
|
|
|
|
|
Programming from Window CE. I have std::wstring fileString. This is converted to C String using
wcscpy(fileBuffer,fileString.c_str())
My problem is that I just want a simple text file to open in another program and process but WriteFile() function is based on bytes so instead of
A)MU09/21/200912:15:22abc500......... I get
B)M U 0 9 / 2 1 / 2 0 0 9 / 1 2 : 1 5 : .........
where each char is 2 bytes rather than 1 byte and other program cannot process
Any help on how to get A versus B would be greatly appreciated.
|
|
|
|
|
The data you have is UNICODE since you're using wstring.
How are you opening the text file? Notepad?
Some programs like Notepad understands that the file is UNICODE by reading a header.
The header is called BOM header.
Read more about it here - Byte-order mark[^]
In your case you should write FF and FE as the first 2 bytes to the file before writing your data.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Your program is using std::wstring which has unicode (utf-16) string but another program you say may expect std::string which has ascii (or utf-8) string.
A solution is that you should change your wstring encoding to string like this.
std::string fileString;
size_t len = wcstombs(NULL, fileBuffer, 0);
fileString.reserve(len);
wcstombs(fileString.data(), fileBuffer, len);
WriteFileA(hFile, fileString.c_str(), fileString.length(), &dwRitten, NULL);
Or you can change your program to non-unicode program which always uses std::string , char and xxxA api's.
|
|
|
|
|
norish wrote: Or you can change your program to non-unicode program
He's in CE; that's not an option.
|
|
|
|
|
The Win32 function WideCharToMultiByte[^] will give you the most control over converting to UTF-8 or ANSI. ANSI may lose information, but UTF-8 will not. On the flip side, programs reading your data may not read and convert UTF-8 correctly.
|
|
|
|
|
A dialog is blocked by sending/waiting actions.
I need to know if user clicked a combo-box in blocked time, do something if yes or close the dialog.
the message is WM_LBUTTONDOWN, whose index in message loop is unknown.
How to get the specified message from message loop?
|
|
|
|
|
How are you waiting in the dialog?
Are you using WaitForSingleObject or WaitForMultipleObjects ?
If so, try using MsgWaitForMultipleObjects instead.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|