|
Have you stepped into ProcessShellCommand() (to find the statement that is throwing the exception)?
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
It crashes at EnterCriticalSection in below function of C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\afxcrit.cpp
void AFXAPI AfxLockGlobals(int nLockType)
{
----
----
// lock specific resource
EnterCriticalSection(&_afxResourceLock[nLockType]);
-----
}
|
|
|
|
|
V K 2 wrote: What could be the problem and possible fix for this.
A bug in your code probably caused by the migration itself.
Keep in mind also that although the crash originates from that call that doesn't not insure that the cause is specifically there. Pointer bugs can cause problems long after the problem code was executed.
|
|
|
|
|
hi all,
GetShortPathName function provide a short path name of a specipied file that is exist.
i want to get short file name or short path name before file creation please help me how can i do this?
thanks in advance.
|
|
|
|
|
You can't do that because the short pathname is generated when you create the file. That function could at most predict what the short name will be. GetShortPathName() reads that info from disk.
|
|
|
|
|
so what can i do to create a file with short name?
|
|
|
|
|
Don't know what is the actual problem you wanna solve.
|
|
|
|
|
Don't use more than 8 characters for the name and 3 for the extension.
|
|
|
|
|
Great wisdom speaks, I didn't see the tree from the forest.
|
|
|
|
|
pasztorpisti wrote: Great wisdom speaks
Not really, I was being facetious.
|
|
|
|
|
Le@rner wrote: i want to get short file name or short path name before file creation please help me how can i do this? Are you looking for GetTempFileName() ?
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
DavidCrow wrote: Are you looking for GetTempFileName() ?
How would one use that to produce a file name based on a long file name? That is what the OP is asking.
|
|
|
|
|
jschell wrote: How would one use that to produce a file name based on a long file name? That is what the OP is asking. Since he is already using GetShortPathName() to produce a short file name based on a long file name, I'm not real sure what he is asking.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
DavidCrow wrote: Since he is already using GetShortPathName() to produce a
short file name based on a long file name,
No that isn't what the OP says.
|
|
|
|
|
|
Hello,
I develop add-ons for MS Flight Simulator and I use the poorly documented SDK for this. The SDK provides a .h file in which an interface class is defined (with pure virtual methods only), something like this:
class IPanelCCallback {
public:
virtual IPanelCCallback* QueryInterface (PCSTRINGZ pszInterface) = 0;
virtual bool ConvertStringToProperty (PCSTRINGZ keyword, SINT32* pID) = 0;
virtual bool ConvertPropertyToString (SINT32 id, PPCSTRINGZ pKeyword) = 0;
};
In my code, I use this interface like this:
IPanelCCallback* pCallBack = panel_get_registered_c_callback("fs9gps");
...
SINT32 id;
pCallBack->ConvertStringToProperty(propertyName, &id);
Everything works fine, but I don't understand why... I thought the linker would stop with an "undefined symbol" error because the IPanelCCallback methods, such as ConvertStringToProperty, are declared as pure virtual but defined nowhere, and I don't use any library for linking. With such an interface class, I thought I would have to defined a subclass of IPanelCCallback and define the ConvertStringToProperty method. My code works, so I shouldn't complain, but I would like to know more about the use of interface classes, this is a subject I don't know much.
Any information is greatly welcome !!
Thank you,
Eric
|
|
|
|
|
The essence of virtual functions/methods is that you don't know and don't have to know what is the actual implementation of the given function. This can be used to design code that uses polymorphism (object oriented programming), or to hide actual implementation from the user (this is probably what happens in your case).
The interface is implemented by the flight simulator. They have a class that implements that interface and that class is already compiled to the flight simulator. You dont need the source of that implementation either. That interface is just an instruction to your compiler, it tells your compiler how to call the already compiled implementation (binary) inside the flight simulator. Maybe you should look up some tutorials on how virtual functions work in c++ (vtables), its useful to know how things work in detail.
|
|
|
|
|
Simplifying the previous answer a bit.
You think that pCallBack is a IPanelCCallback.
It isn't. It is some other class.
That class is derived from IPanelCCallback so your code works.
|
|
|
|
|
Hello!
My question is, do STL containers store a copy or they keep the object itself? Hence, can I insert a local variable into a container?
typedef struct{
int number;
string name; } myData;
class myClass{
void InsertData(myData &a);
void oneFunction ();
void otherFunction ();
collection <myData> m_memberCollection;
};
void oneFunction() {
myData localData;
localData.name = "Paul";
InsertData(localData);
}
void myClass::InsertData (myData &a){
a.number = 5;
m_memberCollection.push_back(a);
}
void otherFunction (){
printf ("%s %d", m_memberCollection[0].name.c_str(), m_memberCollection[0].number);
}
Or do I need to use a collection of the type collection<*myData> ?
|
|
|
|
|
piul wrote: Or do I need to use a collection of the type collection<*myData> ?
That would be a collection of pointers, which would probably lead to memory leaks and/or loss of information. Your original code takes copies of the objects and adds them to the collection, so the data is retained.
|
|
|
|
|
|
Not particularly pertinent to the question but just a quick note... You don't need to write typedef struct s in C++ the way you do in C to introduce a new type. Instead you can just write:
struct myData
{
}; and it'll do almost the same thing as your typedef (try adding some member functions to see what the difference is).
|
|
|
|
|
I wonder how many people will catch that hint, so here goes:
The only difference is that the typedef'd struct is unnamed, so you cannot add a constructor or destructor! You could fix that by adding a name explicitely:
typedef struct myData_struct {
...
} myData;
But of course then you wouldn't need the typedef at all since myData would be synonymous to myData_struct .
|
|
|
|
|
Absolutely right, but for those of us with K&R hardwired into the brain it's a tough habit to kick.
|
|
|
|
|
hi
i am calling the video player exe in my application that will show preview for the user.
now the problems is that i want to disable the child window or window untill this exe run.after completion of preview the window should enable .
Here is my code :
void CPreview::OnpreviewBtnClk()
{
::MessageBox(m_hWnd,_T("here is the preview "),_T("INFORMATION"),MB_ICONINFORMATION);
TCHAR szCmdline[MAX_PATH];
CString szWindowTitle = _T("rs-mplayer");
VERIFY(::GetModuleFileName(AfxGetApp()->m_hInstance, szCmdline, _MAX_PATH));
szCmdline [StrRChr (szCmdline, NULL, _T('\\')) - szCmdline] = _T('\0');
_tcscat_s(szCmdline, _T("\\rs-mplayer.exe /"));
ShellExecute(NULL,_T("open"),szCmdline,NULL,sourceFileName,SW_SHOWNORMAL);
Sleep(500);
CWnd *pOtherWnd = CWnd::FindWindow(NULL, szWindowTitle);
h_Rs_playerProcessId =pOtherWnd;
if (pOtherWnd)
{
MYDATA m_mydata;
wcscpy(m_mydata.m_pName,sourceFileName);
m_mydata.m_bNameLength = (BYTE)sourceFileName.GetLength();
m_mydata.m_ullNodeSize = m_li64FileSize.QuadPart;
COPYDATASTRUCT cpd;
cpd.dwData = 1;
cpd.cbData = sizeof(MYDATA);
cpd.lpData = (void*)&m_mydata;
copyDataResult = pOtherWnd->SendMessage(WM_COPYDATA,
(WPARAM)AfxGetApp()->m_pMainWnd->GetSafeHwnd(),
(LPARAM)&cpd);
}
ProcessID;
<pre><pre>
}
Please reply me soon
got struct from past two days
Best Regards
sarfaraz
|
|
|
|