|
Anyone know if it's possible to create a shell extension that will change the text shown in the file type column in the same way as the IExtractIcon shell extension allows you to display a custom icon according to file content?
|
|
|
|
|
Does anybody know any tool that can be used to identify data types used in files?
I need to search and list out all the data types (primitive, MFC, STL data types) used as class members, function parameters, etc., in a large volume of c++ files (need to consider the header files only).
modified on Friday, December 12, 2008 4:47 AM
|
|
|
|
|
my initial thought would be along the lines of find a parser & grammar for c++, generate a parse-tree and walk that looking for the declarations you need ...
[edit] its not an easy thing you ask .. this is one way http://www.devincook.com/goldparser/[^]
alternatively, I guess you can do a brute force match against an array of key-words representing what you'd like to identify, eg {"map","vector","int","string"...} there was an article about this on cp somewhere
It depends on context/what/how you will use the info
'g'
|
|
|
|
|
Thank you... I have some time constraint too...
|
|
|
|
|
I have a global variable defined as "char toAscii[255]" in some MyFile.c
I declared another variable as "extern char *toAscii" in some other file YourFile.c of same console application.
In YourFile.c, I accessed toAscii as "toAscii[0] = 1;"
No linking error. Linker generate mangaled name same for both as "int * toAscii" (?toAscii@@3PAHA)
but at runtime "toAscii[0] = 1" is causing crash because it point to a NULL while debugger showing a valid address.
If I change "extern char *toAscii" to ""extern char *toAscii[]", every thing works fine.
I just want to know why in first case it toAscii points to NULL at runtime while we have same mangaled name for both. I am using VC2005.
Manish Agarwal
manish.k.agarwal @ gmail DOT com
|
|
|
|
|
There are difference in the code generated for "toAscii[0] = 1;" when toAscii is declared as "extern char *toAscii" and "extern char toAscii[]".
1. When toAscii is defined as "extern char *toAscii"
toAscii[0] = 1;
00401DED mov eax,[toAscii (004167c0)]
00401DF2 mov byte ptr [eax],1
2. When toAscii is defined as "extern char toAscii[]"
toAscii[0] = 1;
00401DED mov byte ptr [toAscii (004167c0)],1
I hope you understood.
|
|
|
|
|
yes, but you don't think that linker should be able to report such errors. Why it resolve "extern char *toAscii" to char "char toAscii[255]"
Manish Agarwal
manish.k.agarwal @ gmail DOT com
|
|
|
|
|
Manish K. Agarwal wrote: but you don't think that linker should be able to report such errors
Yes, as you mentioned if the mangle name where different, this wouldn't have happened. Try reporting it in http://connect.microsoft.com/[^]
|
|
|
|
|
Hi,
IIRC the correct way to handle this is:
- have a single .c file (say file1.c) that declares the variable (either char toAscii[256] or char* toAscii)
- have all other interested .c files refer to it using extern char* toAscii
the best way to do that is to include it in a .h file
- best is to have file1.c also include that header, so the compiler checks both are compatible.
Doing it that way the variable gets allocated only once, and the declarations are correct and available everywhere.
|
|
|
|
|
How to write the program to solve the formula 2n*(2n-1)............1 in c++
neha
modified on Friday, December 12, 2008 4:17 AM
|
|
|
|
|
There are (at least) two ways:
- use a loop.
- use recursion.
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]
|
|
|
|
|
long result = 1;
for (int i = 2 * n; i > 1; --i) {
result = result * i;
}
Manish Agarwal
manish.k.agarwal @ gmail DOT com
|
|
|
|
|
Please do not do peoples homework for them.
If you want to be helpful then it would be better to send them some links to searches at google so that the OP can find the answer for themself.
I would but I never ever answer "urgent" questions.
|
|
|
|
|
Dear All,
I am having a USB serial device and I want to create handle to the device whenever the device is connected.
I want to open the handle using VID and PID of the USB serial device. I tried using SetupDi calls but not detecting the ports. The below is my code snippet. Please help me to solve this issue.
bool status = false;
bool bRet = false;
HDEVINFO devInfoSet = INVALID_HANDLE_VALUE;
SP_DEVICE_INTERFACE_DATA pDeviceData;
SP_DEVINFO_DATA devInfoData;
devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
DWORD index = 0;
ULONG i=0;
ULONG requiredLength=0;
pDeviceData.cbSize = sizeof(SP_INTERFACE_DEVICE_DATA);
devInfoSet =SetupDiGetClassDevs(&GUID_DEVINTERFACE_COMPORT,NULL,NULL,(DIGCF_PRESENT | DIGCF_DEVICEINTERFACE) );
if(devInfoSet!=INVALID_HANDLE_VALUE)
{
while(TRUE)
{
bRet = SetupDiEnumDeviceInterfaces(devInfoSet, NULL,
&GUID_DEVINTERFACE_COMPORT, index,
&pDeviceData );
int x = GetLastError();
if(bRet)
index++;
else
break;
}
}
|
|
|
|
|
Hi,
I have some problems with the edit control. I want to count the chars if it, but the message i send to the control only receives the right character num for the first line.
For exmaple. The first line can have 60 chars. If I only enter 50 or so, the message gives me the right count. If I then enter a longer text, so that the first line have all the 60 chars and the second line have only 30 chars, then the message returns also a number of 60 chars for the second line, but why ? Where is the problem ?
My line:
dwChars = (DWORD)SendDlgItemMessage(hwnd,IDC_INPUT,EM_LINELENGTH,(WPARAM)3,(LPARAM)0);
I hardcoded the line 3 here, normally I am going through a for loop.
|
|
|
|
|
Okay i found the error. I think the wparam needs the offset of the char in the complete edit field. So I first sent the EM_LINEINDEX message and now I thinks its working.
|
|
|
|
|
EM_LINELENGTH message wants the index of a character (of the wanted line) as WPARAM , hence, if you need the lenght of the third line, use:
INT iCharIndex = SendDlgItemMessage(hwnd,IDC_INPUT,EM_LINEINDEX,(WPARAM)2,(LPARAM)0);
INT iLineLen = SendDlgItemMessage(hwnd,IDC_INPUT,EM_LINELENGTH,(WPARAM)iCharIndex,(LPARAM)0);
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]
|
|
|
|
|
Hi All
How can i use short cut key for open and close dialog box?Plz help me
|
|
|
|
|
|
Normally and SDI an application mainframe can split using splitterWnd from CMainFrame,
Can i split the new fromview in the same application which is not the main view
|
|
|
|
|
Cant you code it explicitly using a static splitter?
|
|
|
|
|
Hi' I'm new to C++?
This code to show current date.
#include <iostream.h>
#include "string.h"
#include "time.h"
#include <stdlib.h>
int main()
{
tdclass TimeDateClass;
cout<<"Today is "<<TimeDateClass.date()<<endl;
system("pause");
}
How to compare date we input and compare is it less or more from the current date?
Tq
|
|
|
|
|
One idea is to convert the dates to corresponding number of days and compare.
|
|
|
|
|
Can you show me more details!
|
|
|
|
|
For example,
days1 = day1 + month1*31 + year1*365;
days2 = day2 + month2*31 + year2*365;
if( days1 > days2 )
{
do something
}
else
{
do something
}
|
|
|
|