|
Before deleting the file,try using
<br />
SetFileAttributes(FileName,FILE_SHARE_DELETE);<br />
|
|
|
|
|
poda wrote: SetFileAttributes(FileName,FILE_SHARE_DELETE);
FILE_SHARE_DELETE is used along with the CreateFile() API. It cannot be used in SetFileAttributes() function.
|
|
|
|
|
I hope you find the answer,early.
|
|
|
|
|
|
|
Looking for activex controls to activate on CEdit controls and more for touch screen computer development. Some of our customer's tablets are XP Pro passive touch and some others are XP Tablet. Would like user ablity not to go to keyboard or rely on the virtual embedded keyboard. For example, if needing to enter numeric values allow activation of control by entering the CEdit or by even a button beside the CEdit control. This would allow current and new method. At that time, we would have the ability to allow the user to enter in numeric values and/or maybe even having a way to calculate. At that time, the number can be sent to the CEdit control.
Working still in VC 6++ and would need activex
thanks
|
|
|
|
|
I have a variable that contain 1.#QNAN00000000000.
Is it possible to tell to the VS2005 debugger to pause the application when NAN (or INF...) happens?
(to know, without step every instruction of the program, where is the problem)
Russell
|
|
|
|
|
You can do something like this in debug mode using _isnan()[^] and DebugBreak()[^]:
if(TRUE == _isnan(*dMyVal))
{
DebugBreak();
}
for non-MFC you could do something like this using interrupt 3[^]:
if(TRUE == _isnan(*dMyVal))
{
__asm
{
int 3;
}
}
To check for both infinity and NaN at the same time you could do this:
__inline bool IsInfinifyOrNan(const double& n)
{
return (*((unsigned*)&n + 1) & 0x7FF00000) == 0x7FF00000;
}
if(TRUE == IsInfinifyOrNan(dMyVal)
{
__asm
{
int 3;
}
}
Best Wishes,
-David Delaune
|
|
|
|
|
You should never check for "TRUE == foo()". You need to check for either "FALSE != foo()" or just "foo()" if foo() returns a nonzero value on success.
You would be amazed how many times I've seen this construct result in unexpected behaviour.
|
|
|
|
|
Thanks for the tip. You are correct for _isnan() in that the documentation states:
_isnan returns a nonzero value if the argument x is a NAN
I falsely assumed it was returning a BOOL when I wrote my comment.
Thanks again,
-David Delaune
|
|
|
|
|
Hi All,
We have custom side bar on our IE, I want to disable sidebar close(x) button on my browser, It is placing lefe side of the window and it is not main close button for IE.
Thanks in Advance
ashok
|
|
|
|
|
Hi,
I have a need to use Thread Local Storage but not in the way thats documented (MSDN)
from the documentation a DWORD tlsindex is allocated when during a PROCESS_ATTACH message in the DLL..... tlsindex = TlsAlloc() there after every thread in the process
using this DWORD
I personally have yet to get this to work so I am guessing that everytime you do a TlsSetValue withis dword index it bumps up the number so when you subsequently do TlsGetValue you get the pointer associated with this number
Doesn't seem to have anyting to do with a thread where the actual pointer has something to do with stack (the stack being the local storage of the thread)
If I misunderstanding now the TLS Api's work I would be greatly appreictive if someone set me striaght
|
|
|
|
|
ForNow wrote: I am guessing that everytime you do a TlsSetValue withis dword index it bumps up the number
Huh? Bumps up what number?
The index is global - it is the same for ALL threads in the process.
What a given thread puts in the slot (designated by the index) is local to the given thread.
These may help:
Thread Local Storage[^]
Using Thread Local Storage in a Dynamic-Link Library[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Okay then my question is can I set A value for a Thread that is not the Current Thread
After I create My Thread Control does automatically transfer to the DLL_THREAD_ATTACH message
I have at that point a thread id for the the thread for which I wish to do a TLSetValue
is is this do-able ????
I would like to inform The DLL_THREAD_ATTACH message the nature of the thread like Set pointer via TlSsetValue
and have the DLL reterive it With TlsGetValue as my DLL is acting as a kind of server to the threads of the process and
it would be helpfull to know what the nature of the thread is
|
|
|
|
|
ForNow wrote: I would like to inform The DLL_THREAD_ATTACH message the nature of the thread like Set pointer via TlSsetValue
I don't think this will work. To set a value in the thread's local storage, you need to
be running in the context of that thread, in which case the DLL_THREAD_ATTACH notification
in the DLL entry point will have already been executed.
Can you just handle all this stuff in the thread proc itself?
Do you really need to do this in the DLL entry point?
You could initialize the thread's local storage at the beginning of the thread proc
then call a function in the DLL instead (your own "DLL_THREAD_ATTACH" message ).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I think I found something to do what I need
Get access to the next to the TLS before DLL_THREAD_ATTACH
Before I start this discussion I have noticed the Microsoft has a very robus debugging features
I guess now with multicore/multithread/async procedures timing maybe very different while running code through a debugger and normal processing
Anyway I think I can use these debugging features to get what
Use WaitDebugEvent go into debug_loop and wait for CREATE_THREA_DEBUG_EVENT
comapre the the id From The CreateThread if qual use CREATE_THREAD_DEBUG_INFO structure
the second member is lpThreadBase at offset x'2c' is the ThreadArraypointer this is index by the return value from TlsAlloc
I havent tried this
going to tonite
Just thought of something dont know if I have access this peiece of stroage
I guess in User Mode
Will try this onite
Thnakx again
|
|
|
|
|
When using GetThreadContext to get a thread debugging structure the second data member lpthreadlocabase Msdn says the at offset 0x2c is threadLocalstoragepointer is this and the TLS slot one and the same ?????
|
|
|
|
|
Hi All,
I have a dialog (say CMyDlg) from which i show a message box(AfxMessageBox). I call the DoModal() of the CMyDlg. After a while with the same instance of CMyDlg i close the dialog by calling EndDialog.
My Question::
1. If the message box is shown, is it possible to close that first and then close the CMyDlg.
Main Condition : I am not supposed to use the ::FindWindow for the AfxMessageBox since the message box title will keep changing with time.
Please help.
Regards
Sunil
Sunil
|
|
|
|
|
You're going to struggle. But you don't *have* to use MessageBox - there's nothing stopping you using a second dialog that you designed and have code control over - then you can post messages (ie, WM_COMMAND/IDCANCEL, WM_CLOSE) more easily.
MessageBox is a very useful straitjacket, but it still restricts you.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
sunilpv1982 wrote: 1. If the message box is shown, is it possible to close that first and then close the CMyDlg.
Possible, maybe, but it doesn't make much sense. Why are trying to use
modal dialogs modelessly?
sunilpv1982 wrote: I am not supposed to use the ::FindWindow for the AfxMessageBox since the message box title will keep changing with time.
How did you find the window to change its title?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
Thanks for replying.
Mark Salsbery wrote: Possible, maybe, but it doesn't make much sense. Why are trying to use
modal dialogs modelessly?
If i use CMyDlg in a modeless fashion(also providing a parent window handle), the user will still be able to control the parent window. I want the user to respond within a timeout value. If there is no response then close the CMyDlg window and any message boxes opened within CMyDlg.
Mark Salsbery wrote: How did you find the window to change its title?
AfxMessageBox/MessageBox has a title. The ::FindWindow API gives the handle to the window by passing the title. In my case the title displayed in the MessageBox keeps changing with time(as a result of some SQL query).
Sunil
|
|
|
|
|
sunilpv1982 wrote: the user will still be able to control the parent window
You can disable the parent window. That's what MFC does to simulate a modal dialog.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
I'm using Visual Studio 2005. I have a workspace in visual C++ 6.0 which provides a set of library functions[DLL]. I have a client application which uses one of the function in the library. This client was working perfectly in VC6.0, but when I ported to VC8, it started showing link error:
Signature of the Function in the library[DLL] Header:
ULONG sendInfo(const bool isRequest, TCHAR pParameters[MESSAGES_PARAMS][MESSAGE_SIZE], ULONG netCallId);
Implementation of the Function in the library[DLL] Source:
ULONG NIHAI_TAPI::sendInfo(const bool isRequest, TCHAR pParameters[MESSAGES_PARAMS][MESSAGE_SIZE], ULONG netCallId)
{
....
....
....
}
Client Application Call:
TCHAR messageParameters[MESSAGES_PARAMS][MESSAGE_SIZE];
ULONG netCallId;
bool request;
returnCode = tapiConnection.sendInfo(request, messageParameters, netCallId);
But I'm getting a link error:
nihai_worker.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned long __thiscall NIHAI_TAPI::sendInfo(bool,unsigned short (* const)[81],unsigned long)" (__imp_?sendInfo@NIHAI_TAPI@@QAEK_NQAY0FB@GK@Z) referenced in function "private: unsigned long __thiscall NIHAI_Worker::sendToTAPI(unsigned int,unsigned short (* const)[81],unsigned long)" (?sendToTAPI@NIHAI_Worker@@AAEKIQAY0FB@GK@Z)
Kindly suggest a resolution for the above problem.
Thanks in Advance.
regards,
Rajesh
|
|
|
|
|
One thing I know (there are soooome others) is that VC6 defaulted to not-unicode, and VC8 defaults to unicode.
TCHAR means different things depending on the defines. So your program could be thinking TCHAR = wchar_t (ie, short), while the lib you're linking against was compiled with TCHAR = char, and the two decorated functions no longer match...
So, to resolve it, you need to make sure both of your chunk of codes agree on what TCHAR means.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
u 2 fast -> i 2 drugz.
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
|
|
|
|