|
Hi!!
This is the code of my project..For exm..First time when i call function then
webdocupath = D:shah\myproject\webdocu\parth...ok now when i will call second time then
D:shah\myproject\webdocu
and so on..
I want at any time webdocupath =D:shah\myproject\webdocu\parth
CString webdocupath,pmysection;
void Confwebd()
{
// TODO: Implement the command
CString szIniFileName,ResFilePath;
GetModuleFileName(hArxInstance,szIniFileName.GetBuffer(MAX_PATH), MAX_PATH);
szIniFileName.ReleaseBuffer();
szIniFileName = szIniFileName.Left(szIniFileName.ReverseFind(_T('\\')) +1) + _T("WebDokuConf.ini");
// When resource from this ARX app is needed, just
// instantiate a local CAcModuleResourceOverride
//CAcModuleResourceOverride resOverride;
CConfWebD dlg(CWnd::FromHandle(adsw_acadMainWnd()));
dlg.m_strFileName = szIniFileName;
//SendDlgItemMessage(dlg,IDC_WEBDLIST,CB_GETCURSEL,0,0);
if(dlg.DoModal() == IDOK)
{
pmysection = dlg.str;
webdocupath = dlg.pstr2;
}
}
void Webdocu()
{
ads_name en;
ads_point pt;
AcDbObjectId entId1;
AcDbEntity *pEnt1;
int rc = acedEntSel(NULL,en,pt);
switch(rc)
{
case RTERROR :
acutPrintf(_T("Invalid object."));
return;
break;
case RTCAN :
acutPrintf(_T("User canceled."));
return;
break;
}
AcDbMText *myText;
AcDbBlockReference *pMyBlock;
acdbGetObjectId(entId1, en);
acdbOpenAcDbEntity(pEnt1,entId1,AcDb::kForRead);
acutPrintf(_T("\nClass is:"));
acutPrintf(pEnt1->isA()->name());
if((pEnt1->isKindOf(AcDbBlockReference::desc()))){
pMyBlock = AcDbBlockReference::cast(pEnt1);
acutPrintf(_T("\nSelected Object is block:"));
// Now get the attribs in the block
AcDbObjectIterator *pAttrIt;
AcDbAttribute *pAttrib;
pAttrIt= pMyBlock->attributeIterator();
CString x1, x2;
for (pAttrIt->start(); !pAttrIt->done(); pAttrIt->step()) {
pMyBlock->openAttribute(pAttrib,pAttrIt->objectId(),AcDb::kForRead,Adesk::kFalse);
x1 = pAttrib->textString();
acutPrintf(x1);
acutPrintf(_T("\n"));
pAttrib->close();
}
acutPrintf(_T("\n"));
}
if ((pEnt1->isKindOf(AcDbMText::desc()))){
myText = AcDbMText::cast(pEnt1);
acutPrintf(_T("\nSelected Text is:"));
acutPrintf(myText->contents());
pEnt1->close();
CString mywebdocupath,path1;
webdocupath = webdocupath.Left(webdocupath.ReverseFind(_T('\\')));
path1 = webdocupath.Left(webdocupath.ReverseFind(_T('\\')) + 1)+_T("WebDoku\\");
mywebdocupath = path1 +_T("loopo\\WG_LL.txt");
CString LoopListFile (mywebdocupath);
CStdioFile LoopList;
CFileException e;
CString FileName1,Filename2,Path;
if(LoopList.Open(LoopListFile,CFile::modeRead,&e)){
CString Oneline(""),LoopName(""),FileName("");
int pos1,pos2;
for (int i = 0; i < 4; i++){
while(LoopList.ReadString(Oneline)){
pos1 = Oneline.Find(_T("\1"));
FileName =Oneline.Mid(pos1 +1);
pos2 = FileName.Find(_T("\1"));
if(pos2>0){
FileName1 = FileName.Mid(pos2+1);
}
if(pos1 > 0){
LoopName = Oneline.Left(pos1);
if(LoopName.CompareNoCase(myText->contents()) == 0){
acutPrintf(_T("\nStrings are equal"));
FileName = path1 + FileName1;
ShellExecute(NULL,(_T("open")),(FileName),NULL,NULL,SW_SHOWNORMAL);
return;
break;
}
}
}
}
acutPrintf(_T("\nStrings are not equal"));
}
acutPrintf(_T("\nThere is no selected text in "));
acutPrintf(pmysection);
acutPrintf(_T(" section"));
LoopList.Close();
return;
}
}
Shah Satish
|
|
|
|
|
Shah Satish wrote: Here i am using value from Void confwebd ( ie mypath)
Are you assigning it a new value?
Shah Satish wrote: ...may be have to make global value...
Based on the code snippet you've shown, it already is global.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Nop..I am not assigning new value.
|
|
|
|
|
You said that the contents changed. What is inside ?
If you don't assign a new value and the contents changed, that means you have a buffer overflow somewhere.
|
|
|
|
|
Hi guys. I just have a quick question about the declaration of the socket function bind and the sockaddr_in structure. Both declarations are given below.
int bind (SOCKET s, const struct sockaddr * saddr, int namelen);
struct sockaddr_in
{
short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
}
My question is: What purpose does the 'struct' keyword serve WITHIN these declarations. (the part in bold above) I've never seen this use of the 'struct' keyword before. Thanks in advance.
|
|
|
|
|
Well this one is needed as far as I knnow to store the adress you want to listen, f.ex.
<br />
SOCKADDR_IN lSockAddr;<br />
memset(&lSockAddr,0, sizeof(lSockAddr));<br />
lSockAddr.sin_family = AF_INET;<br />
lSockAddr.sin_port = htons(8500);<br />
lSockAddr.sin_addr.s_addr = INADDR_ANY;
and afterwards you can check if all initialize went OK with
<br />
if(lSockAddr.sin_addr.s_addr ==INADDR_NONE)<br />
|
|
|
|
|
Sorry. Maybe I wasn't clear about my problem. I'm not asking how to use the bind function or the sockaddr_in structure. I'm just curious why they are declared the way they are. i.e., why is the 'struct' keyword needed in the places I have in bold. It seems to me like it's not really necessary. I'm sure I'm wrong but I don't understand why.
|
|
|
|
|
Well the first "struct" is simply the parameter required when you pass the function. Secondly, it is not uncommon to have a structure that is contained in another structure, that is perfectly legal.
|
|
|
|
|
I appreciate your reponses guys but I think you're missing the point of my question. Let me rephrase it.
Observe the 2 following code snippets. Both are almost identical accept one uses the 'struct' keyword in the declaration and the other doesn't.
struct MyStruct
{};
void MyFunction (const MyStruct * pMyStruct)
{
return;
}
struct MyStruct
{};
void MyFunction (const struct MyStruct * pMyStruct)
{
return;
}
Despite these differences, both pieces of code compile.
So whats the point in using the 'struct' keyword at all?
Microsoft doesn't use it other functions when passing a struct or struct pointer to a function. So why do they do it in the socket function bind? Is it simply for clarification or is it more important than that?
|
|
|
|
|
It's a difference between C and C++.
In C, names declared with struct , union and enum are in a different namespace to the built-in types and typedef s. You have to use the appropriate keyword when you use it, otherwise you'll get an error.
It's very common for a struct declaration to be included within a typedef declaration so that the namespace is 'flat'. In theory you could declare a typedef with the same name as a struct , union or enum .
C++ does away with this: there is no separate struct , union or enum namespace. It's not an error to prefix a type name using struct , union or enum , (not sure about class ) but is no longer necessary. I think the compiler is supposed to check, if you do use the keyword, that the type is actually what you say it is (i.e. struct , union or enum ).
|
|
|
|
|
Thanks too you also Chris. Very thorough.
|
|
|
|
|
This use of the struct keyword is a relic from C where it is a part of the type name.
In C++ it's perfectly legal to omit the struct keyword.
E.g. for C
struct MyStruct
{
int nFirst;
int nSecond;
};
int main( int argc, char* argv[] )
{
struct MyStruct theStruct;
MyStruct theStructCopy;
}
and for C++
struct MyStruct
{
int nFirst;
int nSecond;
};
int main( int argc, char* argv[] )
{
struct MyStruct theStruct;
MyStruct theStructCopy;
}
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Makes perfect sense now. Thank you Roger.
|
|
|
|
|
The icons on the windows system menu are made from the true type font Marlett. Does anybody know how I can use these icons? Are they created from the font at runtime (how?), or are they allocated as icons in a ressource (which?).
MS
|
|
|
|
|
Neither-Nor
see MSDN: DrawFrameControl, if should be the DFCS_CAPTIONCLOSE, DFCS_CAPTIONMAX etc. uState values
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers! We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP Linkify!|Fold With Us!
|
|
|
|
|
Thanks, thats seems to be the solution.
MS
|
|
|
|
|
Hi
I want application to convert unicode enabled. so for this i am converting all datatype to wide characters.if i used only widecharacter datatypes then Is they applicable for both unicode and ASCII.
|
|
|
|
|
I suspect you want TCHAR.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
The wchar_t type can be used by both ANSI and Unicode applications, just like int and double can be.
But what exactly do you mean by "Unicode enabled"? Do you mean that you want the application to support Unicode text, but still run on ANSI-only systems like Win 9x/me, or you want to write a native Unicode application, that only uses the Unicode APIs, and not the ANSI ones?
Any application, regardless of an ANSI or a Unicode build, can manipulate both Unicode and ANSI data, and can even make calls to both versions of API functions. For example:
MessageBoxA( NULL, "ANSI", "MessageBox", MB_OK );
<code>MessageBoxW( NULL, L"Unicode", L"MessageBox", MB_OK );</code> When developers talk about a Unicode application, they generally mean a Unicode build of the application, which means that it is linked against the Unicode Windows API libraries, and will not run an an ANSI-only system.
There is no such thing as a TCHAR application. There is TCHAR-based code can be used to create both both ANSI and Unicode builds. TCHAR and TCHAR-based identifiers/names like _tcscpy(...) get converted to the character type for the build being done.
For example, for an ANSI build, TCHAR becomes char , _tcscpy(...) becomes strcpy(...) and MessageBox(...) becomes MessageBoxA(...) .
For a Unicode build, TCHAR becomes wchar_t , _tcscpy(...) becomes wcscpy(...) and MessageBox(...) becomes MessageBoxW(...) .
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi all,
I have a C function in my dll workspace. This function is exported from the dll. I want to return value from the function. The value is of enum type. The declaration and the defination of this enum type variable is in some different .h file. so how should i export this function and get the return value.
I have exported the function by using the following statement.
__declspec(dllexport) rs_result rdiff_sig(const char *BasisPath, const char *SigPath);
i am getting error messages and they are :
error C2146: syntax error : missing ';' before identifier 'rdiff_sig'
error C2501: 'rs_result' : missing storage-class or type specifiers
fatal error C1004: unexpected end of file found
How should i solve this issue.
Please help me.
Thanks
Datta
|
|
|
|
|
If you return an enum, the program using the dll needs to know what it is, so you need to include the header file containing the declaration of the enum in your program also.
|
|
|
|
|
Yes i included the .h file and it worked.
Thanks
|
|
|
|
|
Hi all,
I have a win32 dll workspace. In this workspace i have most of the files as .c files. I want to export one of the function from this dll. The function is a static function. so for that function if i export it in this way
__declspec(dllexport) static rdiff_sig(const char *BasisPath, const char *SigPath);
i am getting one error message as below.
error C2201: 'rdiff_sig' : must have external linkage in order to be exported/imported
What should i do to solve this problem.
Thanks
Datta K.
|
|
|
|
|
I'm not an expert in C programming but I think that declaring a global function as static means that it is only accessible from within that file. Did you try what your compiler told you ? That is specify the function as extern (put the keyword extern in front of it) ?
|
|
|
|
|
I want the caption bar buttons(i.e,mim,max,and close) to be removed completely.Is it possible.
|
|
|
|
|