|
Hi,
OK, here's the situation: Inherit Code. Shown menu item (an existing form) that needs to have a new control added to it so a user can create a new directory to store their files in. This previously existing form allows me to either cancel or hit OK. No problem. So I naively add an edit control and recompile the code. The form displays and I press cancel(or OK, whatever). Assertion error. So I go looking.
I discover I'm having a problem where the resource files I create are not creating unique identifiers for each control. I've ruled out the logic behind any of the existing code; because all I have to do it add the control to see these errors.
For instance, my resource.h file contains many, many, many entries. Some of the values for the entries have the same numerical constants( See 1016, 1017, & 1018):
<br />
#define IDC_DTC_CNT_LBL 1008<br />
#define IDC_DTC_CNT_VALUE 1009<br />
#define IDC_CRNT_DTC 1010<br />
#define IDC_PNDG_BUTTON 1011<br />
#define IDC_FREEZE_FRAME 1012<br />
#define IDC_Meter 1015<br />
#define IDC_COMBO1 1016<br />
#define IDC_SPECIFIC_CODE_COMBO 1016<br />
#define IDC_TRIGGER_COMBO 1016<br />
#define IDC_COMBO_CATEGORY 1016<br />
#define IDC_CMBO_APPLICATION 1016<br />
#define IDC_COMBO3 1017<br />
#define IDC_COMBO_DOWN 1017<br />
#define IDC_MIN_COMBO 1017<br />
#define IDC_COMBO2 1018<br />
#define IDC_COMBO_APPLICATION 1018<br />
#define IDC_CMBO_CATEGORY 1018<br />
#define IDC_DataList 1019<br />
#define IDC_O2_LIST 1021<br />
#define IDC_BUTTON1 1022<br />
#define IDC_GET_DTC 1022<br />
#define IDC_BTN_ADD 1022<br />
#define IDC_BTN_ITEMCHECK 1022<br />
#define IDC_BUTTON2 1023<br />
#define IDC_BTN_REMOVE 1023<br />
#define IDC_BUTTON3 1024<br />
#define IDC_BTN_REMOVEALL 1024<br />
#define IDC_METER_UP 1026<br />
#define IDC_METER_DOWN 1027<br />
So, the simple answer is to clean it up, right? Not so fast, quick draw. I did that( renumber them start from 100, then starting at 1000 - for their appropriate resource-section.) and now the form isn't even displayed before the assertion errors happen. I click the menu-item and BAM - ASSERTion city.
It seems to me that there are cross-references to other resources in other resource files.
Are there any tools to clean up resource issues like this with VS? Now, here's the kicker: I'm using eVC 4.0 SP4. Yeah, me.
Props to those who reply.
|
|
|
|
|
search for ResOrg here on CP, it's a nice tool made by Anna that helps cleaning up the resources.
|
|
|
|
|
Thanks! I'm checking it out now.
|
|
|
|
|
Hi,
I have a service written in C++. When I get SERVICE_CONTROL_STOP command, I want to check certain condition and if that condition is false then return an error and not stop the service.
In the service control handler function (registered by RegisterServiceCtrlHandler), I have a code which looks as follows:
void service_ctrl(DWORD dwCtrlCode)
{
...
switch(dwCtrlCode)
{
....
case SERVICE_CONTROL_STOP:
if ( CanStop() == FALSE )
{
// stop not allowed.
ssStatus.dwCurrentState = SERVICE_RUNNING;
ssStatus.dwWin32ExitCode = NO_ERROR;
ssStatus.dwCheckPoint = 0;
if (!(fResult = SetServiceStatus(
sshStatusHandle, // service reference handle
&ssStatus))) { // SERVICE_STATUS structure
// LOG SOME ERROR
}
}
else
{
// stop allowed.
....
}
break;
}
...
}
The problem is:
When I stop the service, by running "net stop MyService", it displays "service could not be stopped", the service status remains "started" and this is great.
But when I run "net stop MyService" again, it displays "The service could not be controlled in its present state" and the service status becomes blank.
How should I decline service stop request properly?
|
|
|
|
|
According to the docs:
SERVICE_CONTROL_STOP
Notifies a service that it should stop.
If a service accepts this control code, it must stop upon receipt. After the SCM sends this
control code, it does not send other control codes.
Windows XP/2000: If the service returns NO_ERROR and continues to run, it continues to receive
control codes. This behavior changed starting with Windows Server 2003 and Windows XP SP2.
|
|
|
|
|
i want to extract the pixels 320x320 from the webcam browser on monitor screen and put into the array. Anyone can help me in this problem about the source code or related information?
love-peace-joy
|
|
|
|
|
What's the webcam browser?
There's APIs available for video capture that may give you better results than trying to
scrape the screen.
|
|
|
|
|
Hi All,
I have a dll in vc++( It shows one dialog with some static box and list control) .
Case 1. If i create this by statically linked in project settings and keep mantain it's default settings( with out support unicode)
then it used properly in my project ( Give the desired output)
Case 2. If i create it unicode compatiable by using all unicode liberary in project settings then As i use it into my project and build , my project buid properly but terminate as i execute it. ( My project is also unicode compatiable)
Why it is happening , is there any other way to build the unicode compatiable dll, or any other type of setting other then exe settings.
Thanks
SNAV
|
|
|
|
|
singh_nav wrote: my project buid properly but terminate as i execute
Does this mean , it is crashing ?
Have you tried to debug it ?
|
|
|
|
|
yes i tried to debug it , But it crash before it comes in the App class Init function .
ND
|
|
|
|
|
I have a dll written in C where in the function parameter does not contain any device context.
I want to use that dll to draw in a view or dialog in VC++.
I am able to link the dll and the function returns the correct parameter value but no drawing appears
Can someone help please
mk
|
|
|
|
|
, code ?
|
|
|
|
|
mk79 wrote: C where in the function parameter does not contain any device context
And how do you get your Device Context for drawing?
(i.e. post code please...)
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.
|
|
|
|
|
Can you show snippet code
|
|
|
|
|
Hi
How can we find out the difference between dates.Is there any method to find that .please kindely help me.
#sanroop#
|
|
|
|
|
Have you tried using class COleDateTime ,COleDateTimeSpan ?
|
|
|
|
|
Iam very thankful for your raply.I saw all methods in COleDateTime,COleDateTimeSpan here my problem is to find the difference between current date and any otherdate what ever i give.
#sanroop#
|
|
|
|
|
|
Sanroop wrote: ...my problem is to find the difference between current date and any otherdate what ever i give.
Which is what COleDateTimeSpan does, assuming you are using MFC. Otherwise, check out difftime() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
What format are your dates in?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
For converting to FILETIME you may use:
1) LocalFileTimeToFileTime()
2) "Converting a time_t Value to a File Time" article in MSDN
3) DosDateTimeToFileTime()
The FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
This time format is the most sensitive I ever met in Windows.
You may just construct an INT64 numbers and subtract them.
Every 10000 units == 1 millisecond (1/1000 second)
So I second contains 1000*10000 units.
Good Luck!
|
|
|
|
|
Hi,
I have a project to do which consists on implementing a solution to make firewalls more dynamic.
The code which I should write it must be integrated in XP firewall, free BSD,... .
How can I find an API compatible with different OS and which can manage firewall rules.
Thanks.
|
|
|
|
|
Search for UPnP. It has limited use in opening and closing ports and manipulating port
forwarding on UPnP-enabled devices.
If firewalls were programmable they'd be kinda useless
|
|
|
|
|
|
From what i've understood, the mainframe title is stored in the string table. How can i change it at runtime?
Here's what i want to do:
Let's say the application title is MyApp. For some reasons it becomes MyApp USERID. Doing this for the main window is easy with setwindowtext, but when i open a document it switches back to MyApp and the title switches from "MyApp USERID" to "My App - Document1"
How do i change it so that it doesn't change back?
|
|
|
|