|
I have made a .net application which uses a COM component hosted by a C++ service. The service is a simple C++ service developed using ATL (and not using MFC).
Everything works fine on my dev machine as most of the work is done by VisualStudio itself.
Now I have to make installer of my application (application should be able to get install on XP, VISTA and Windows 7). I am following below steps to register my service:
"C:\Program Files\MyApplication\MyService.exe" -service (For registering the service)
"C:\Program Files\MyApplication\MyService.exe" -Embedding (For registering the COM component hosted by service)
And to unregister my service and COM component hosted by it I am following below step:
"C:\Program Files\MyApplication\MyService.exe" -UnregServer
Q: Please let me know if steps to register and unregister the service and COM component it hosts, are correct or I am doing something wrong. Or I am missing something.
I don't have VISTA and Windows 7 on my machine and have not ever worked on them. So its important to confirm before I release my application.
Thanks in Advance
Regards
Aseem
|
|
|
|
|
Good day.
Is there an "efficient" way to check if a resource ID used in the code is effectively defined in the resource file ?
For example if a function is declared but not defined, the linker will report an error if the function is called.
I'd like to be able to report that if I do something like that :
#define IDS_MY_STRING 1234;
CString s;
s.LoadString(IDS_MY_STRING);
and IDS_MY_STRING is not in the RC file.
The compiler and/or the linker and/or the resource compiler will warn me about that.
Thanks.
Max.
Watched code never compiles.
|
|
|
|
|
You could use the "source browser" to check all references to IDS_MY_STRING .
"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
|
|
|
|
|
As far as I know, it doesn't exists a way to do automatically what you are asking for.
What you can do in Visual Studio is: go to the Resource view of your project (you can use the shortcut Ctrl+Shift+E), then right-click on the root node of your resources (e.g. on myproject.rc) and choose the option Resource Symbols....
What you get is a list of all the identifiers defined inside the resource.h file, each one with its numeric value and a flag indicatin whether there exists or not a resource inside the .rc file that uses it. In the textbox named Used by: you have informations about which kind of resources exists that use the selected identifier.
|
|
|
|
|
Hello,
I would to develop an application in c++ to decode some messages.
The user can specify the value of each field and when a message arrives, it is decoded with the rules first specified.
e.g.
I have a message formed by 16 bit and at most I can have 32 messages in the same frame.
The user can add the rules to decode the frame.
Beginning the uses must specify the fields that form the frame and when the frame arrive, the application fills the fields specified by the user.
How can i implement this application?
is there some tool that simplifies the development?
Thank You,
Andrea.
|
|
|
|
|
The word message is overused in software, so that it doesn't mean anything at all outside its context. I guess you are talking about a couple of bytes which come from a certain source (e.g. a serial port).
AFAIK there's no library which could help you for that. However, this shouldn't be too complex to implement yourself. But it depends also what you have to do exactly: how does this parsing works ? Can you give a concrete example (with a concrete message and concrete rules) ?
|
|
|
|
|
thanks for your answer.
A message is represented as Int16 type.
The user, at run-time, can specify e.g (rule):
bit1 :on/off field
bit2 - bit5: address
bit 6 - 11: sub address
and so on...
another rule could be:
bit1: T/R field
bit2 - bit10 telemetry
and so on...
When i write code don't know the rules.
When the rules have been specified, the user select a particular rule and when arrive a message, the specified fields are filled according to the selected rule.
Thank You.
|
|
|
|
|
Andrea Di Domenico wrote: the specified fields are filled according to the selected rule.
I still don't get what those fields are. Are they simple variables ? Any particular type ?
As Carlo suggested, you might take a look at a scripting language, although this is perhaps a bit overkill for your case (that's what I'm trying to figure by asking you so many questions).
|
|
|
|
|
You may embed a scripting language in your application, like (the excellent) Lua. Then, users can formulate the decoding rules by implementing functions (or simple data structures) using the hosted language.
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 not sure how experienced you are in C++ but one thing you will find is that the address operator (&) does not work with bits of a byte. This will be a very important factor since you are configuring which bits to peel apart.
One thing I have done to help with this is I made functions to unpack the bits of a byte into an array of bytes and to also do the converse - pack the LSB of an array of bytes into one byte. Here is what the unpacker looks like :
void BitUnpack( uchar byteArray[], uchar bits )
{
for( uint n = 0; n < 8; ++n )
{
uchar mask = 1 << n;
byteArray[n] = ( bits & mask ) ? 1 : 0;
}
}
This will give you an array of bytes where each one corresponds to the value of the bit at that location. This means that byteArray[2] will be 1 if the 3rd bit is set and it will be 0 if not. If you unpack all of the bits of your message into array of bytes it will be easy to then repack, say, bits 3-7 into one value and so on.
Note that the function above unpacks just one byte. If you call this repeatedly you can unpack all of the bytes you receive into arrays for processing later. BTW - you may want to tweak the packer function to have it pack arbitrary numbers of bits to make things easier for you later. Here's the packer I use :
void BitPack( uchar byteValue, uchar byteArray[] )
{
for( uint n = 0; n < 8; ++n )
{
if( byteArray[n] )
{
uchar mask = 1 << n;
byteValue |= mask;
}
}
}
If you always work exclusively with 16-bit values then change the uchars to ushorts and the 8s to 16s and you should be ready to go. I should mention that I define the uchar, ushort, uint, and ulong types for myself but you don't have to use those since VC++ already defines the capitalized versions of these types.
What this all comes down to is sorting out the bits and then reassembling them later. I hope these functions give you some ideas on how to approach this.
modified on Tuesday, October 26, 2010 6:13 PM
|
|
|
|
|
Congrats! You invented std::bitset[^]
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
I doubt it. Those two functions were first written more than twenty years ago. 
|
|
|
|
|
Hi Rick,
Rick York wrote: Those two functions were first written more than twenty years ago
Dont' be ashamed to be a precursor C++ improved a lot from this time, and is improving again with C++0x.
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
|
Hi Andrea,
Have a look at std::valarray<bool>[^] and the associated std::slice[^].
Not much more out there to help you.
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Hi all i am using mysql remote database i am able to connect and retrieve the records from the remote database. But i am unable to update the records.
Please healp.
see my code;
CRecordset cRecord(&db);
CString csQuery;
csQuery.Format(L"select * from %s where product_name = %s", m_TableName,m_ProductName);
cRecord.Open(CRecordset::snapshot, csQuery, CRecordset::none);
if(cRecord.IsOpen())
{
while(!cRecord.IsEOF())
{
cRecord.Edit(); ;
//here i have to update the price column please help me
cRecord.Update();
cRecord.MoveNext();
}//while(!cRecord.IsEOF())
cRecord.Close();
db.Close();
Thanks in advance
|
|
|
|
|
jiya-123 wrote: But i am unable to update the records.
Why not?
jiya-123 wrote: cRecord.Edit();
Did you first call the CanUpdate() method to see if the recordset can be updated?
Also, are you attempting to catch any exceptions (e.g., CDBException )?
"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,
My intention is to find the best possible method for my requirement. Please share your ideas.
Requirement:
I need to create a dialog bar (I think so) in which I have to place controls (including some custom controls) dynamically. The controls can be placed in one row or more according to a dynamic setting. If there is not enough space to hold all the controls, a drop down button should be there at the right side of the dialog bar. When that button is pressed, the remaining controls should be listed as a popup. The dialog bar need to be dock-able too.
My plan:
Searching for direct support in MFC/Win32. If there is no such support, I am planning to create a custom dialog bar (or derive from CDialogBar) and implement the rest.
Thank you.
- ns ami -
|
|
|
|
|
Sounds like the ordinary toolbar control would help you there. You can replace buttons with custom controls, and add chevron style for the items that doesn't fit. There are plenty of articles here on CP for that.
|
|
|
|
|
Thank you for the reply. Now, I think it is better if we dynamically manage dialog bar controls than going for chevron feature. Also chevron is from rebar control, which does not support docking.
- ns ami -
|
|
|
|
|
Hi!
When I run my project, the application crashes and exception pointer goes to a file called crtexe.c. This is my Call Stack.
65720000()
druidsTech.dll!1009f009()
[Frames below may be incorrect and/or missing, no symbols loaded for druidsTech.dll]
druidsTech.dll!1009f9f1()
> TreasureHunter.exe!mainCRTStartup() Line 403 C
kernel32.dll!761fd0e9()
ntdll.dll!76df19bb()
ntdll.dll!76df198e()
Any of the file names in the call stack is not defined by me. How to solve this crash?
|
|
|
|
|
Use your debugger to locate the problem in your code. Put breakpoints just before the crash occurs and checks if all the variables are correctly set.
|
|
|
|
|
T.RATHA KRISHNAN wrote: Any of the file names in the call stack is not defined by me.
You have one out of three (?) possible problems.
1. You have called an API with illegal parameters.
2. You have corrupted memory which can affect any part of your program.
3. The third party code is causing the problem.
For 1 and 2, use the debugger. For number 3, check if there is a software fix/update.
|
|
|
|
|
For starters it would be nice if you had more symbolic information (to avoid getting frames in the callstack like this: druidsTech.dll!1009f009 ). Have you got symbols for these files?
Steve
|
|
|
|
|
druidsTech.dll!1009f009()
[Frames below may be incorrect and/or missing, no symbols loaded for druidsTech.dll]
druidsTech.dll!1009f9f1()
It shows that No Symbols [PDB files] Loaded for the dll DruidsTech.dll. If you have all the required PDB files you are call stack is informative.
TreasureHunter.exe!mainCRTStartup()
TreasureHunter is the Binary Unit, mainCRTStartup is call. So, you do have pdb information for TreasureHunter.exe.
The answer is get the PDB files for the Binaries to get more information on call stack/
|
|
|
|