|
I have a VC++/MFC application that I am converting from VS6 to VS2005. After much trudgery I have it compiling but the linking is failing with.
1>CVTRES : fatal error CVT1100: duplicate resource. type:DIALOG, name:24029, language:0x0409
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
I have two resource files in the project: the default app.rc and an additional shared.rc (shared with other applications). I #include the shared.rc from within the app.rc. This all works fine under VS6.
I am also using Stingray Grid and Toolkit. These .rc files are not explicitly part of the project but are also include through the resource includes (in app.rc).
I know I don't actually have duplicate resources so I figure it must be some little configuration issue causing this. The dialog (24029) is in shared.rc and it's not the problem. If I reorder the dialogs in the resource it'll error on whichever is first.
I have done some renumbering to insure I'm not stepping on other resource IDs with no luck. Originally I was getting the same error but for "type:CURSOR, name: 3". I only have 2 cursors in my project and they definitely don't have 3 as their resource ID.
Help? Thank you much.
Eric Margheim
|
|
|
|
|
Hi all,
how can I create plugins for media player?
And how to know where the slider is?(time)
Please help me,
If there is any helpful article for creating pluging I would like to know.
thanks.
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
|
If pchar and CString are both equivalent to a C-style null-terminated string, what is the advantage of using one over the other?
Kitty5
|
|
|
|
|
kitty5 wrote: what is the advantage of using one over the other?
CString is a class that encapsulates managing the memory and other string manipulation routines.
|
|
|
|
|
cool beans.
Thank you!
Kitty5
|
|
|
|
|
I am a newbie developing an evc++ 4.0 application for a handheld
computer running CE .NET 4.2. Is there a way to set focus to indivdual elements of the Date Time Picker, like the month? Currently, focus is being set to the day.
Sande
|
|
|
|
|
I don't think the CDateTimeCtrl has any methods like CEdit's SetSel.
You could try simulating the user pressing the right arrow key using SendInput or keybd_event, if those functions are even available for CE. You might run into problems with the date formatting and locales though.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Hi Steve.
Thank you for your response. I believe that both SendInput and keybd_event are available for CE. I will give them a try. Thanks.
Sande
|
|
|
|
|
Hallo sandem,
I recently got a very good help here to format a DateTimePicker. I needed a DateTimePicker without days (only with month and years). The suggestion was to use a CDateTimeCtrl instead of a COleDateTime within a dialog. If you are interested in, I'll send you some code, but as I am an absolute beginner, I think this will not be new for you.
Ciao, Gerard
|
|
|
|
|
Hi Gerard.
I too am an "absolute beginner" so I appreciate all responses/suggestions/advise. I have mapped a CDateTimeCtrl to my date time picker but would be interested in seeing your code. Thank you.
Sande
|
|
|
|
|
Hallo sande,
I had the problem, that I used a COleDateTime-variable and was not able to format it like "MM-yyyy" or anything else. So I was suggested to use a CDateTimeCtrl, as you do, and to use the command
m_begin.SetFormat("MM-yyyy");
in the OnInitDialog().
Worked fine, but I was not able anymore, to get the entered values back where I wanted - thats been after
if (dialog.DoModal() == IDOK)
{
......
So I had to declare a variabe like this
public:
COleDateTime p_begin;
in my dialog and in my dialog.OnOk() I had to use
m_begin.GetTime(p_begin);
This works fine (with the only fault, that I don't know how to give the CDateTimeCtrl special starting-values) and I can use fuctions like
year.Format("%i", dialog.p_begin.GetYear());
after the OnOK().
Good luck, Gerard
-- modified at 15:17 Thursday 22nd June, 2006
|
|
|
|
|
We're using tons of bitmap buttons in our application, and I always wondered how people use the Resource editor to put those buttons and have them well aligned.
Since the Resource editor is working in DLU how do I know that the buttons align ?
Now, I have to do it manually, which seems to be counter-productive; placing one button and put all the rest in reference to that first one.
I know that if I put a Bitmap CStatic and assign it a bitmap, the control will use the size of the bitmap; is there such a thing for buttons ?
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote: We're using tons of bitmap buttons in our application
Maximilien wrote: which seems to be counter-productive
Yes it does. Perhaps a Usability Study and UI Design rework could be considered?
|
|
|
|
|
Are you wanting to know how to use the resource editor, or what guidelines to follow?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
yes and no, I know ( I think ) how to use the resource editor.
My problem now, is only (mostly) with CBitmapButton .
In MSDN, on the CBitmapButton page there is :
To include a bitmap-button control in a dialog box
1. Create one to four bitmap images for the button.
2. Create a dialog template with an owner-draw button positioned where you want the bitmap button. The size of the button in the template does not matter.
Yeah, cool, but heck the position and size are in DLUs not in pixel. I can only approximatly position and size the buttons in resource editor.
for example, I have a series of CBitmapButton buttons with bitmaps that are 40x40 pixels. How can I adjust the positions of each buttons ?
Or, for example, if I have a simple CButton with the BS_ICON or BS_BITMAP flag enable, I'd like to be able to see the bitmap in the button when designing the dialog.
I don't know if you understand what I'm trying to do ? or achieve ?
I know that the CBitmapButton does not seems to be fully supported, not the in palette of controls in the resource editor; and I can live with the fact that I need to do things manually.
My things are working, but it just seem like I'm doing too much; maybe it's the fact of life when doing UI that is not 100% window lookalike.
Thanks
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote: Yeah, cool, but heck the position and size are in DLUs not in pixel.
Right. I suppose exceptions to the rule exist, but I've never had the need to be concerned with pixels. DLUs are portable, pixels are not.
Maximilien wrote: I can only approximatly position and size the buttons in resource editor.
I think all you need to be concerned with is the top and left sides as the control will adjust its width/height accordingly.
Read here for more.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Please come to my forum. I need new people in my forum.
http://cppmasters.iphpbb.com
THX.
-:KNOX:-
|
|
|
|
|
Read #10 here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
come on knox, you know you're a looser... why linking your forum where the best programming questions are on CP
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Hi there,
I am basically having trouble acquiring the pointed value of a pointer. Below is the code I am working with.
<code>
int main( void ){
char* RegLocation = "";
char rspath[255];
strcpy(rspath,"");
if(GetRegistryValue(HKEY_LOCAL_MACHINE,"SOFTWARE\\Red Storm Entertainment\\Rogue Spear","InstallationPath",rspath)){
lstrcat(rspath, "\\");
lstrcpy(RegLocation, rspath);
if(retrieveLogFileLocation(RegLocation)){
if(GenerateStats(RegLocation, hOutput)){
}
}
}
return 0;
}
BOOL GetRegistryValue(HKEY key, const char* path, const char* name, char* value)
{
HKEY hKey;
strcpy(value,"");
if (RegOpenKeyEx(key, path, 0, KEY_EXECUTE, &hKey) == ERROR_SUCCESS)
{
char szBuf[MAX_PATH];
DWORD dwLen=MAX_PATH;
if (RegQueryValueEx(hKey, name, NULL, NULL, (unsigned char*) szBuf, &dwLen) == ERROR_SUCCESS)
{
strcpy(value,szBuf);
RegCloseKey(hKey);
return TRUE;
}
RegCloseKey(hKey);
hKey = NULL;
}
return FALSE;
}
bool retrieveLogFileLocation(LPSTR lszRSPath){
char lszValue[255];
char search[255];
lstrcpy(search,lszRSPath);
lstrcpy(lszValue,lszRSPath);
lstrcat(search, "*.log");
WIN32_FIND_DATA wfd;
HANDLE hFind = FindFirstFile(search, &wfd);
if (hFind != INVALID_HANDLE_VALUE) {
do
{
string foo = wfd.cFileName;
if (foo.find("RSResults") != -1)
{
lstrcat(lszValue,wfd.cFileName);
lstrcpy(lszRSPath, lszValue);
FindClose(&wfd);
return TRUE;
}
} while (FindNextFile(hFind, &wfd));
FindClose(&wfd);
}
return FALSE;
}
bool GenerateStats(LPSTR lszLogFile){
HANDLE hLogFile = NULL;
bool pSuccess = FALSE;
cout << "Value pointed is " << lszLogFile << endl;
cout << "Value dereferenced is " << *lszLogFile << endl;
hLogFile = CreateFile(lszLogFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if(hLogFile != INVALID_HANDLE_VALUE){
cout << "Able to create file" << endl;
DWORD dwFileSize, dwRead;
dwFileSize = GetFileSize(hLogFile, NULL);
if(LockFile(hLogFile, 0, 0, dwFileSize, 0))
{
HANDLE hHeapFile;
LPVOID lpvHeapFile;
hHeapFile = HeapCreate(0x00040000, dwFileSize, 0);
if((DWORD)hHeapFile != STATUS_NO_MEMORY)
{
lpvHeapFile = HeapAlloc(hHeapFile, HEAP_ZERO_MEMORY, 0);
if(parseLogFile(hLogFile, lpvHeapFile, dwFileSize, dwRead)){
pSuccess = TRUE;
}
HeapDestroy(hHeapFile);
}
}
UnlockFile(hLogFile, 0, 0, dwRead, 0);
CloseHandle(hLogFile);
}
return pSuccess;
}
</code
My issue is that in the function definition GenerateStats outputting lszLogFile outputs the correct file path, so the value lszLogFile is pointing to is correct, however if I dereference the pointer, I get a value of c which is incorrect. c is what is passed onto the function CreateFile which is incorrect. I actually want the value that is referenced by lszLogFile to be passed onto that function.
I have tried multiple ways on passing on the pointed value with no success. I have tried to type-cast it in multiple ways such as: LPSTR, LPCSTR, const char* as well as changing the function parameter type of lszLogFile in the GenerateStats parameter list to different types. I have also tried copying the value of lszLogFile using lstrcpy() to another variable (as well as trying to static_cast the variables to various types) and it still does not work. Everytime I try to use lstrcpy() and I attempt to type cast say in the form of something like this:
LPSTR lpcsLogFile;
lstrcpy(lpcsLogFile, lszLogFile);
lstrcpy(lpcsLogFile, static_cast<const char*>(lszLogFile));
I receive unhandled exception errors (which I do understand why it happens but i've exausted all my know how in order to solve the problem!).
So if anyone can see where I am making my mistake, I would really appreciate any input.
Thanks!
Robbie
-- modified at 12:46 Tuesday 20th June, 2006
Made some grammatical changes!
|
|
|
|
|
Didn't look through the whole code since I see similar errors littered all over.
char* RegLocation = "";
:
lstrcpy(RegLocation, rspath);
You should ask yourself where RegLocation is pointing to, and how much memory is available at that location. You should also ask yourself if modifying a string literal makes sense.
Any reason why you are not using std::string or CString?
|
|
|
|
|
capricious_001 wrote: char rspath[255];
strcpy(rspath,"");
Use this instead:
char rspath[255] = {0}; capricious_001 wrote: lstrcat(rspath, "\\");
What if rspath already ends with a backslash? Use PathAddBackslash() instead.
Why mix strcpy() with lstrcpy() ?
capricious_001 wrote: LPSTR lpcsLogFile;
lstrcpy(lpcsLogFile, lszLogFile);
//or this
lstrcpy(lpcsLogFile, static_cast(lszLogFile));
This will not work since lpcsLogFile is a pointer that is not pointing to allocated memory.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks a lot guys, That worked.
This is the change I made.
<br />
<br />
char rspath[255] = {0};<br />
char* RegLocation = rspath;<br />
<br />
As well as removed lstrcat(rspath, "\\"); and replaced it with PathAddBackslash() . Even though that hkey value will most likely never have a backslash I put it in just in case. As well I will keep that function just in case I need it for the future so thank you for that David.
And yes strcpy() was actually lstrcpy() I just forgot the l.
btw what were the other errors that I made hfry? Just so it doesnt bites me in the ass when I'm done this module.
Thanks,
Robbie
-- modified at 14:11 Tuesday 20th June, 2006
|
|
|
|
|
Fixing RegLocation to point to some allocated memory would fix the problems. It was all the same type of error, basically when using strcpy / strcat etc you need to ensure that the destination buffer has enough memory to store the resultant string.
|
|
|
|
|