|
You're using a rather bizarre mixture of Win32, tchar and _UNICODE functions. I assume you have checked elsewhere that the folder you want to delete is empty, right? Also, you don't have to use GetFileAttributes() since you want to delete the folder anyway.
Most importantly, check the return code from SetFileAttributes() with GetLastError() .
If that is successful, use RemoveDirectory() and again check the return value with GetLastError() .
|
|
|
|
|
good morning everybody,
I m very new to windows mobile..... i m using CeDialer application .... I m able to call outgoing call.... now i want to implement call hold.... the msdn says to use LinrHold().... but I dont know where to use it in my code ,,,, and which parameter to pass in it....
I m using visual studio 2005 and windows mobile 6 sdk....
Thanks a lot ...
modified on Monday, April 7, 2008 3:00 AM
|
|
|
|
|
i have 2 exprted functions in a dll ( Win32 dynamiclink dll project )
void __stdcall MsgBox()
{
MessageBox( NULL , "Hello" , "" , MB_OK ) ;
}
void __stdcall MsgBox1( LPSTR a )
{
MessageBox( NULL , a , "" , MB_OK ) ;
}
//i tried following commands , the first one works but the not the secnd one, can any one tell where is the problem ?
//{
rundll32.exe mydll.dll,MsgBox
rundll32.exe mydll.dll,MsgBox1 "hi"
//}
//def file
//{
LIBRARY MyDll
EXPORTS
MsgBox
MsgBox1
//}
Thanks
modified on Monday, April 7, 2008 3:35 AM
|
|
|
|
|
nitin3 wrote: MessageBox( NULL , T , "" , MB_OK ) ;
And what is the output you're expecting from?
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
|
|
|
|
|
sorry that was a mistake, i modified the code.
my problem is the second function MsgBox1 function does not displays the text i entered,
or its shows a message "An exception occured while trying to run "mydllfile.dll"
Thanks & Regards
|
|
|
|
|
To exploit the rundll32.exe your exported function must follow some rules, for instance the prototype must be like the following
void CALLBACK MsgBoxW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow);
then a working sample (at least, on XP it works...) will be
void CALLBACK MsgBoxW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow)
{
MessageBox(hwnd, lpszCmdLine, L"MyMessageBox", MB_OK);
}
with def file
LIBRARY "MyDLL"
EXPORTS
MsgBoxW @1
for a complete discussion see [^]
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
|
|
|
|
|
you have eyes of vulture..
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Please let me know how much bytes transfferd by putfile() function.
Is there any api avilable?
|
|
|
|
|
How to calculate how much bytes transfferd by putfile() function at any instant
|
|
|
|
|
chetanjoshi9 wrote: How to calculate how much bytes transfferd by putfile() function at any instant
you have to create system wide api hook on PutFile, please see if it could help :-
search following text in the CodeProject.com search box "system AND wide AND api AND hooking", you will find good number of article on above mentioned subject!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Please let me know how can I get the current internet speed in vc++
Is there any API available?
|
|
|
|
|
check if this could help! winnetstat[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Hello everyone,
I read the code for class CComMultiThreadModelNoCS of ATL. What means,
--------------------
(Section Threading Model Support, Chapter 3 Objects in ATL, ATL Internals)
CComMultiThreadModelNoCS is designed for multi-threaded objects the eschew object-level locking in favor of a more fine-grained scehme?
--------------------
My understanding is the object designed could use other approaches other than critical section, like mutex/event to do synchronization. Not sure whether my understanding is correct?
thanks in advance,
George
|
|
|
|
|
Hello everyone,
In the ATL Internals book, one form of constructor of CComQIPtr is implemented as this,
CComQIPtr (IUnknown* lp)
{
p = NULL; if (lp != NULL) lp -> QueryInterface (*piid, (void**)&p);
}
I think there is a bug when QueryInterface fails, and the original value of member variable p is overwritten.
I found the in MSVC 2008, the implementation is,
atlcomcli.h
CComQIPtr(_In_opt_ IUnknown* lp) throw()
{
if (lp != NULL)
lp->QueryInterface(*piid, (void **)&p);
}
Seems the bug is fixed? Is it a bug in old version of ATL or a bug in the book?
thanks in advance,
George
|
|
|
|
|
George_George wrote: I think there is a bug when QueryInterface fails
I see no bug.
George_George wrote: and the original value of member variable p is overwritten.
The original variable? It's a constructor George!
When QueryInterface fails, having a null pointer, IMHO, is the expected behaviour.
George_George wrote: Seems the bug is fixed? Is it a bug in old version of ATL or a bug in the book?
The essence of the behaviour doesn't change here.
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
|
|
|
|
|
Thanks CPallini,
CPallini wrote: When QueryInterface fails, having a null pointer, IMHO, is the expected behaviour.
You mean when QueryInterface fails, QueryInterface will set the input parameter pointer to null?
regards,
George
|
|
|
|
|
George_George wrote: You mean when QueryInterface fails, QueryInterface will set the input parameter pointer to null?
Yes. You know that.
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
|
|
|
|
|
Thanks CPallini,
Question answered. I previously wrongly think it is assignment operator, other than constructor.
regards,
George
|
|
|
|
|
In my program, I pick a pivot p from a database S of strings, compute the median r of the distances of other string objects to p and then divide the other objects into roughly equal-sized subsets S1 and S2 as follows:
<pre>
S1={o e S \{p}|d(p,o)<r}
S2={o e S \{p}|d(p,o)>=r}
</pre>
where d(p,o) is the distance of the database object o to pivot p.Thus, the objects in S1 are inside the ball of radius r around p, while the objects in S2 are outside this ball. Applying this rule recursively leads to a binary tree,where a pivot object is stored in each internal node, with the left and right subtrees corresponding to the subsets inside and outside the corresponding ball,respectively.
Below I give the function for the above criteria but when I call the function from main and try to print the tree in preorder, nothing gets printed nor does the program terminate. I will really appreciate if someone can help me find the errors in my code and where I am going wrong:
<pre>
void query_ball()
{
string str;
int i=0,p;
int arr[1000];
char B[40];
char C[40];
vector<string> myStrings(1000);
int r;
int n1;
ifstream file("text.txt"); //this file is the database containing 1000 strings
for(p=0;p<1000;p++)
{
getline(file,str);
strcpy(B,str.c_str());
myStrings[p]=B; // copying the file strings to vector myStrings
}
srand(time(0));
int pos;
pos=rand()%1000;
strcpy(C,myStrings[pos].c_str()); // C is the pivot picked randomly
for(i=pos;i<=998;i++) // deleting element at myStrings[pos] which contains pivot C
myStrings[i]=myStrings[i+1];
myStrings[i]="";
for(p=0;p<999;p++)
{
strcpy(B,myStrings[p].c_str());
arr[p]=edit(B,C); // arr contains edit distances between other string objects and pivot C
}
/*edit function relates to edit distances of pivot from other string objects. An edit distance between 2 strings is found by changing one string to another with the minimum number of insertions, deletions and/or replacement of characters in the strings.*/
n1=(999+1)/2;
r=arr[n1]; // r is the median of the distances of other objects to pivot C
for (p=-1; p<999; p++) //p starts with -1 to check first if Root is Null
{
if (Root == NULL)
{
Root = new TreeNode();
Root->val = C;
}
else
{
TreeNode* temp = Root;
while(temp!=NULL)
{ strcpy(B,myStrings[p].c_str());
if (edit(B,C)<r) // checking distances inside ball of radius r
{
if (temp->LChild==NULL)
{ TreeNode* t = new TreeNode();
t->val = B;
temp->LChild=t;
}
else
{
TreeNode* t = new TreeNode();
t->val = B;
temp->LChild = temp->LChild->t;
}
}
if (edit(B,C)>=r) // checking distances outside ball of radius r
{
if (temp->RChild==NULL)
{ TreeNode* t = new TreeNode();
t->val = B;
temp->RChild=t;
}
else
{
TreeNode* t = new TreeNode();
t->val = B;
temp->RChild = temp->RChild->t;
}
}
}
}
}
}
</pre>
<div class="ForumMod">modified on Monday, April 7, 2008 12:18 AM</div>
|
|
|
|
|
Referring to the above codes, I see that when I print the children of the left tree, it gives me segmentation fault. Can somebody please point out why I am getting segmentation fault for the cout statement in the codes below:
if (edit(B,C)<r)>
{
if (temp->LCh==NULL)
{
t1->val = B;
temp->LCh=t1;
}
else
{
TreeNode* t = new TreeNode();
t->val = B;
temp->LCh=temp->LCh->t;
cout<<temp->LCh->val<<endl;
}
}
</r)>
Any help much appreciated.
|
|
|
|
|
I'd like to use spy++ to watch on a window, but that window will hide automatically when it lose focus, which means it will hide as soon as I lauch/switch to spy++.
So how can I do that?
|
|
|
|
|
Actually Spy++ shows hidden windows too.
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
|
|
|
|
|
Yes I know.
But now it's difficult for me to find that window using spy++.
The windows appears to be hidden, but it may already be destroyed. If it's destroyed when losing focus, I can't find it using spy++.
But I really want to find that window and find its class name, window text, ect, which info I can use to find them by code.
So.. Please help me out.
|
|
|
|
|
Hi all: I've got problem with CStdioFile::Open and need your help, below is the code sample:
<br />
CString m_filename="some absolute file path\name";<br />
CStdioFile m_file;<br />
if (!m_file.Open(m_filename,CFile::modeCreate|CFile::modeWrite))<br />
{<br />
AfxMesageBox (_T("Can not open the file"));<br />
}<br />
I'm sure the absolute file path/name is correct and have read/write permission to the file location.
When I run this code from Visual Studio by press CTRL+F5, this code is OK and the file is opened sucessfully. But when running the program out of the studio, I got problem that get into the AfxMesageBox showing the file can not be open.
Lisoft
|
|
|
|
|
CString m_filename="some absolute file path\name";
CStdioFile m_file;
if (!m_file.fOpen(m_filename,CFile::modeCreate|CFile::modeWrite))
{
AfxMesageBox (_T("Can not open the file"));
}
Try this..
Actually CstdioFile used for creating file in runtime so u ll modify above ..
|
|
|
|
|