|
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.
|
|
|
|
|
Hi
I have a software which reads data from a database file (Firebird database). The problem is Firebird database does not protect its user database file (no password protection). I have some key fields in the database I don't want to share with users.
I am using Perl scripts to populate the database. So Perl should be able to run the encryption algorithm.
Could you give me some suggestions?
Best regards,
modified on Monday, September 21, 2009 4:25 PM
|
|
|
|
|
transoft wrote: Could you give me some suggestions?
Post this in the Perl forum!
|
|
|
|
|
Microsoft supplies some Cryptography apis and you can search them in msdn.
|
|
|
|
|
See [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am using static splitter frame (left CTreeCtrl right CTabCtrl) updating the right pane from the left. I am stumped with processing TVN_SELCHANGING and TVN_SELCHANGED. CTreeCtrl generates both notification messages after left mouse button click. I am not sure which one is correct to process in my case.
Could someone please point me to some kind a of code sample / tutorial on this.
So far all my searches were pretty dry and did not explain the purpose of two notification messages on same input.
Thanks for reading. Any help is as always appreciated.
|
|
|
|