|
Thanks Thaddeus.
Problem solved!
|
|
|
|
|
Strings have to be zero terminated.
Replace
char ch[4];
with
char ch[5];
ch[4] = 0;
or something similar to have a zero after the string data.
|
|
|
|
|
Thanks guyee.
Problem solved!
|
|
|
|
|
MVS 2010 – Errors – fatal error LNK1561: entry point must be defined
- Reason:
- You are using MFC and following linker option is missing: /SUBSYSTEM:WINDOWS
- Solution 1:
- If project is created as Win32 Project this linker option will be automaticly set:
- File – New Project ... – Visual C++ – Win32 – Win32 Project
- Solution 2:
- If projec is created as General Empty Project this linker option needs to be manually added:
- RC on ProjectName – Properties – Configuration Properties – Linker – Coommand Line
- Additional Options: /SUBSYSTEM:WINDOWS
OR LET IDE TO DO THIS:
In Visual Studio IDE enter:
Project -> Properties -> Linker -> System -> SubSystem
Now choose in option combox: Windows(/SUBSYSTEM:WINDOWS)
|
|
|
|
|
Is there a question embedded in here someplace?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi all,
i want to know currently how many threads running in my applcation?
please tell me what api or function use for this?
or please tell me how can i do this.
thanks in advance.
|
|
|
|
|
See here[^].
You can use the code from the link, just need to replace the printf call with conditional check - if the process ID matches your own process ID, obtained via GetCurrentProcessId[^].
modified on Wednesday, January 5, 2011 6:13 AM
|
|
|
|
|
|
I have a SDI app using FormView that's not resizable but will have a large and small size. I would like to create small and large dialogs and then have the view display the correct dialog depending on user choice. I don't want to use multiple views because I don't want to recode handlers, etc. My plan is to i.e. have button ID_OK1 in small dialog and button ID_OK2 in large dialog both to to OnOK() so my code only has to be written once. Any ideas would be appreciated. Thanks,
John
|
|
|
|
|
If it is just about the size of the dialog, isn't resizing the child windows based on the user selection a simpler choice? I have seen articles on CP that show how to do that.
|
|
|
|
|
I was thinking about doing resizing but I have another app that allows resizing and it was a bit tedious to change control sizes, rearrange based on the new window size and update font sizes. I was hoping to layout 2 dialogs in the resource editor and then just switch between the two. Is there an easier way to resize controls instead of calc window size, scale controls then move to new relative positions?
|
|
|
|
|
TBH, I never had to do resizing seriously, so I can't say anything useful about that.
About your original issue, I just felt that resizing would be a lot less code, and bloat, than mapping events from both the forms to some base class, friend class etc and processing them.
|
|
|
|
|
I actually did find something useful. Adding this line to the CFormView constructor lets you use any dialog for the form view:
CMFCView::CMFCView()
: CFormView(CMFCsdi2View::IDD)
{
m_lpszTemplateName = MAKEINTRESOURCE(View_IDD_TO_USE);
}
So at run time I can set View_IDD_TO_USE to the resource for IDD_DIALOG1 or IDD_DIALOG2. The form view then gets created with whichever of the resources I choose. I create the event handlers in the view, i.e. OnOK(). The controls in each dialog need to be the same including names so that when the view creates the handlers they can be mapped, i.e. there must be a control named ID_OK on each dialog so the view can correctly map ID_OK to OnOK().
That means no duplicated code, only two dialogs which doesn't add to much overhead. This works great for what I'm doing.
Thanks to Scott McPhillips for the direction.
|
|
|
|
|
My problem: I need to give to icons resources identifiers values based on other (buttons) identifiers values.
example, if i have a button with CM_TEST identifier, i need to have a corresponding icon with a resource ID = CM_TEST+xxxx
I tried the method explained below without success
Including Shared (Read-Only) or Calculated Symbols
http://msdn.microsoft.com/en-us/library/zakskay9.aspx
my rc file contains:
#define APSTUDIO_READONLY_SYMBOLS
#include "dialogh2.h"
#undef APSTUDIO_READONLY_SYMBOLS
my dialogh2.h content some icons identifiers as:
#define IDI_OK (IDOK+20000)
#define IDI_OK_DISABLED (IDOK+30000)
#define IDI_CANCEL (IDCANCEL+20000)
#define IDI_CANCEL_DISABLED (IDCANCEL+30000)
Result: all identifiers are not calculated and seems to get a value of 0.
some observations:
-icon property window show :
ID: "(IDOK+20000)"
(quotes are present)
-when displaying rc resource symbol dialog, my identifiers IDI_OK, IDI_OK_DISABLED ... don't appear (read-only symbols checkbox checked)
-I did some tests as :
#define IDI_OK (1+20000)
same result..
In all cases, identifiers seems to evaluate to 0 (because they become my app icon and i already have an app icon with ID = 1)
How to solve this problem ?
Thank you very much in advance
|
|
|
|
|
The evaluation of resource symbols does not appear to work when those symbols are used as labels in the resource script as:
#define ID_X 100
#define ID_Y (ID_X + 10)
ID_X ICON ...
ID_Y ICON ...
I suspect there is some information in the link you posted, but the comments from Microsoft are not very clear.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Your example is exactly what i see.
Microsoft seems to say that this should work but .... how???
|
|
|
|
|
Pascal_33 wrote: Microsoft seems to say that this should work but .... how???
It doesn't! I have tried this a number of different ways and it just does not work. The problem is that in the .rc file the 'calculated' value is replaced by the preprocessor but the rc compiler does not recalculate it but accepts it as a string value.
#define IDI_X 100
#define IDI_Y (ID_X + 100)
...
IDI_X ICON ...
IDI_Y ICON ...
100 ICON ...
(ID_X + 100) ICON
which is obviously wrong. It seems that rc will not recalculate expressions that are used as labels in resource scripts.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Pardon the silly question: "did you include dialogh2.h in your dialog's source (*.cpp ) file?"
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]
|
|
|
|
|
|
In your post you showed it included into the *.rc file (not inside the dialog *.cpp file).
I've made a test, it worked for me.
Nevermind, I did the wrong test.
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]
modified on Wednesday, January 5, 2011 9:04 AM
|
|
|
|
|
Sorry
Just try to include it in the cpp file and no changes. In your case, is it the fact to include read-only header file the cpp file that is successful?
(I'm really very interested on your tests since i already spent 2 days on this problem without result)
|
|
|
|
|
Sorry, my test was simply wrong.
I haven't yet found a way to make the new defined IDs appear in the Resource Window. However if you're not scared of manually editing the *.rc (with, for instance the notepad) file then you can make it work.
BTW: be careful, IDs > 32767 are reserved for MFC .
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]
|
|
|
|
|
The problem is Visual Studio change ID when it want ...
I try to build many applications (total over 100,000 lines) originally developped with the old Borland c++ 5.0, with the help of OWLNEXT library.
These apps have dialog specific visual aspects (radio, checkboxes, buttons ...) and for example, for a given ID button you can assign icons images displayed inside the button: icon with ID= ButtonID+20000 give a button icon for the normal state, and icon with ID = ButtonID+30000 give a button icon for the disabled state.
This is the context of my work. With the old Borland C++ it was very easy to define resource ID depending on other resource ID.
|
|
|
|
|
If you are using MFC you could use a CBitmapButton MSDN[^]. CBitmapButton ties the image resources to the buttons caption instead of it's ID.
What I do when I have to do this kind of thing is use the readonly resource header, but put manually calculated values in it, it can be a pain to maintain but it works.
|
|
|
|
|
I don't want to use MFC (huge work to convert from OWL library).
I think i have to put manually, as you said, the calculated values in the read-only resource header
|
|
|
|