|
No if your loop has statement you dont need to use of them however its better you use of them and for declare local variables if you have same name for global variables you must be use of them and ....
|
|
|
|
|
Hello,
I am making dll.Earlier the dll was being made.But suddenly the dll is not been made .I can see .dll file in the directory .But when I try to use it with a client the compiler says .dll is corrupt.
When I am making the dll I get 36 warnings and a message
Creating library Debug/BaseClassesDll.lib and object
Debug/BaseClassesDll.exp
What must be wrong?
Pritha
|
|
|
|
|
I have seen this message when the client was linking with the DLL. You need to link with the .LIB, which was created at the same time as the DLL. (The DLL still needs to be present, however.)
|
|
|
|
|
Hello,
Thanks for your reply.
I am not able to make the dll.When I make the dll I can see a .dll file the directory but when I link the file with the client project.the compiler says that the dll is corrupt.
Pritha
|
|
|
|
|
As I said in the first reply, you need to link with the .LIB.
More explicitly (on Visual studio 2005):
1. Click the Project menu.
2. Select your project's Properties.
3. Select "Configuration Properties".
4. Select "Linker".
5. Select "Input".
6. For the entry "Additional Dependencies", enter the name of the .LIB file (not the .DLL file).
7. Click OK.
The linker is expecting to find the .LIB file, but when it sees a .DLL file it thinks it's corrupt. (I agree it should say something more helpful, like, "Dude, where's my library?")
|
|
|
|
|
Did you recompile your project and did you import lib file to program?
|
|
|
|
|
I have 7 child dialogs, & a parent dialog. From parent dialog, I call 1st child, on the child dlg's buttons child sends message to the parent. Among that one message is to update the object in parent which is working fine. The second message is to hide that child and show another child dialog.
I have added method for the message :
afx_msg LRESULT DataEntryDialog::OnSHOW_NEXT_VIEW(WPARAM wparam, LPARAM lparam) {
}
In child1 :
in .h the events are declared as
enum
{
BASE = WM_USER,
CHANGED_DS, SHOW_NEXT_VIEW,
};
void CPage1Dlg::TellParent()
{
this->CRHPostMessageToParent(CHANGED_DS, (int)&deptStock);
this->ShowWindow(false);
CRHPostMessageToParent(SHOW_NEXT_VIEW, 2);
}
In parent:
Childs are created as below in OnInitDialog():
CRect rect(4, 2, 5,2);
CPoint point(0, 10);
childPage1.CRHCreateGenericChildDialog(this, &rect,0, NULL);
childPage1.SetDeptStock(deptStock);
rect += point;
childPage2.CRHCreateGenericChildDialog(this, &rect, 1, NULL);
childPage2.ShowWindow(false);
childVisible = 1;
afx_msg LRESULT DataEntryDialog::OnCHANGED_DS(WPARAM wparam, LPARAM lparam)
{
deptStock = (DeptStock&)lparam;
AfxMessageBox(_T("Dept Stock Updated"));
return 0;
}
afx_msg LRESULT DataEntryDialog::OnSHOW_NEXT_VIEW(WPARAM wparam, LPARAM lparam) {
int childView = (int)lparam;
AfxMessageBox(childView);
if (childView ==2) {
childPage2.SetDeptStock(deptStock);
childPage2.ShowWindow(true);
childVisible = 2;
}
return 0;
}
Any guidance on the above is highly appreciated.
Thanks
Terry
|
|
|
|
|
A lot of dialogs opened in one program is bad style and is confusing the programer and user so you should avoid it.
For communication is messaging between windows and dialogs suitable. Do it via PostMessage to avoid blocking.
For the data you better use one global object so everywhere is the same data. Then you only need to post the message to every open window/dialog that data is changed. Please believe me: make a array of HWND!!!
Greetings from Germany
|
|
|
|
|
Thanks KarstenK,
KarstenK wrote: Please believe me: make a array of HWND!!!
I am gonna make an array of CDialog & place each child dialog in it. Currectly, I am just checking it with 2 dialogs. Can you give some helpline of how to do with PostMessage. The
this->CRHPostMessageToParent(CHANGED_DS, (int)&deptStock); in return calls PostMessage by passing the childDialogId as WPAram
void CRHGenericChildDialog::CRHPostMessageToParent(UINT message, LPARAM lParam)
{
CRHpParent->PostMessage(message, CRHId, lParam);
}
Thanks
Terry
|
|
|
|
|
Trupti Mehta wrote: I have 7 child dialogs, & a parent dialog. From parent dialog, I call 1st child, on the child dlg's buttons child sends message to the parent. Among that one message is to update the object in parent which is working fine. The second message is to hide that child and show another child dialog.
Sounds like you need a property sheet wizard.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Terry,
So you have one parent dialog and 7 child dialogs. At first one of your child dialog will be displayed and if you click one button in child dialog, that child should be closed and next child dialog should be shown until all child dialog finishes. Is that your requirement?
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Yes, want to hide 1 child and show other child. But I want this to be controlled programmatically as the child dialogs need not be in series. I mean after child3, on some basis child5, or child7 or child3 should come respectively.
I work on WinCE5 for a specific device and it doesn't support Property Sheets. WinCe supports, but that device's SDK doesn't support. So, I got to work out manually only.
Thanks
Terry
|
|
|
|
|
Terry,
I hope in your parent dialog, you're creating instance of child dialog and shows it by calling DoModel() .
Instead of child dialog sending message to parent, just close the child dialog by calling EndDialog() function. In the EndDialog() you can give a parameter which will be returned by the DoModel() function. So by checking the return code of ChildDialog.DoModel() , you can show next dialog. For instance,
void CParentDialog::ShowChildDialog()
{
CDialogDlg ChildDialog;
if( SHOW_NEXT_DIALOG == ChildDialog.DoModal())
{
}
}
void ChildDialog::OnNextDialog()
{
EndDialog( SHOW_NEXT_DIALOG );
}
Here in the e.g. if the DoModel() returns SHOW_NEXT_DIALOG, then its the request to show next dialog.
Just try this. Just let me know if you've more issues.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Thanks Jijo,
As the dialogs are not in series & can call previous dialog also. So I call messages SHOW_NEXT_DIALOG with the child dialog # to be shown & it works perfectly. I figured out to work as expected.
Thanks jijo for the efforts.
Jijo, I can't add an int, float to CString. Like I want to add up "Name " + int + float in a CString. How do I achieve it. I tried many ways, but gives error or warnings only. Help me if you can.
Thanks
Terry
|
|
|
|
|
Trupti Mehta wrote:
Jijo, I can't add an int, float to CString. Like I want to add up "Name " + int + float in a CString. How do I achieve it. I tried many ways, but gives error or warnings only. Help me if you can.
CString csMessage;
int nInteger = 10;
float fFloat = 20.0f;
csMessage.Format( _T("%s %d %f"),
_T("Name :"),
nInteger,
fFloat );
Hope the code snippet explains everything you asked.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
How to convert GUID string of
{ 04C99667-DFF4-489F-92C5-5EFE5D18DDD5 }
to
{ 0x00,0x7B,0x00,0x30,0x00,0x34,0x00,0x39,0x00,0x39,........}.
Please help me.
Reagards
Shiva
|
|
|
|
|
[UuidFromString^] may be useful, if you know what this ID stands for you can use CLSIDFromString IIDFromString API.
modified on Monday, June 2, 2008 9:29 AM
|
|
|
|
|
Hello All,
Is there any diff between these 2 ON_MESSAGE & ON_THREAD_MESSAGE.
Both does the same thing & both works for my thread appln.
can any 1 plz tell me the diff of 2 & when 2 use them ??
Thanks in Advance
Vivek
|
|
|
|
|
ON_MESSAGE: Message in one thread, sended with PostMessage
ON_THREAD_MESSAGE: Message in different threads, sended with PostThreadMessage
Read the fine MSDN about it.
Greetings from Germany
|
|
|
|
|
MSDN says
ON_THREAD_MESSAGE must be used instead of ON_MESSAGE when you have a CWinThread clas
Is this the only 1 difference
|
|
|
|
|
Am I missing something here? OK - I can derive a class and write my own method spending a minute of my time, but what annoys me is - am I not supposed to use a CStringArray if I will require to execute a find operation on it? Is there a valid reason for this class not supporting a find method, or is it just ridiculous?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
An argument for not including such Find function is that there are different methods for finding a match. For instance as CString::Compare and CString::CompareNoCase.
I'm not so sure but an array isnt suitable for a lot of findings. If you search a lot you should use an other data type with Hashes, so the members are pre-sorted.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: An argument for not including such Find function is that there are different methods for finding a match. For instance as CString::Compare and CString::CompareNoCase.
Nope, I'm talking about a simple search, the same exact thing, what CString is providing me. If I buy the case sensitivity argument, why not give me an overload?!
KarstenK wrote: I'm not so sure but an array isnt suitable for a lot of findings.
OK - that's the only valid reason I could also think of. I was just wondering if someone else will come up with a different opinion or provide me another reason.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
In case of array , only association is index and element. What purpose should Find operation serve, if provided one ? It should only return it's index. And how that index will be usefull, given that you already have string at that index ? This may be the reason, that it is not logical to provide such function.
Or, you are talking about some more functionality from find operation ? Because, as already mentioned, for string specific find there are already such functions available.
|
|
|
|
|
No, I did not get that first paragraph. When I look at this class as a container, I will expect it to provide me a find function (I pass a string to it, and then it comes back to me to tell that the string is found at location N). It should take less than one minute to derive a class and implement this find method, but I was just wondering why would it not be given to me. This makes the class look like an unfinished container. Can you please explain me the first paragraph? I simply didn't get it. May be I need a whack on my head and a cup of coffee.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|