|
not sure what you mean - if its some sort of program you've written, then its quite easy to keep a 'dirty'/'has-been-modified' flag, set that when ever data is changed, inspect it periodically and save the data if it has been set.
If you mean controlling some sort of other program not written by you then you'll have to supply more information
'g'
|
|
|
|
|
But do you know detail of each file for example pdf files or 3gp files and etc?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
no one is answering everyone is questionning and fighting with each other
Trioum
modified on Tuesday, May 26, 2009 12:54 AM
|
|
|
|
|
because your question is terrible, so vague, either your grasp of english is letting you down or your waiting to be a darwin award poster boy
|
|
|
|
|
What is the question ?
do you need help in writing files of different formats ?
or
do you need help on how to implement an auto-save feature ?
This signature was proudly tested on animals.
|
|
|
|
|
Hi there,
I found a code snippet on the web which converts an ANSI string to UTF-8 format. I implemented it in my own and it works.
<br />
char text[1024]={0};<br />
WCHAR w[1024]={0};<br />
int erg=0;<br />
<br />
strcpy(text, m_pData);<br />
<br />
erg=MultiByteToWideChar(CP_ACP, 0, text, -1, w, sizeof(w) / sizeof(WCHAR));
erg=WideCharToMultiByte(CP_UTF8, 0, w, -1, text, sizeof(text), 0, 0);
After that 'text' is UTF-8 formatted just nicely.
Now I was wondering, why doesn´t the following (slightly altered) code not work? I just created a char* instead of char[];
<br />
char* text = new char[1024];<br />
WCHAR w[1024]={0};<br />
int erg=0;<br />
<br />
strcpy(text, m_pData);<br />
<br />
erg=MultiByteToWideChar(CP_ACP, 0, text, -1, w, sizeof(w) / sizeof(WCHAR));
erg=WideCharToMultiByte(CP_UTF8, 0, w, -1, text, sizeof(text), 0, 0);
Thanks,
Souldrift
|
|
|
|
|
My guess is in the first example the sizeof operator can calculate the size of the array. When it comes to pointers - no such luck. Try passing the size of the allocated memory directly (preferably by using a #define):
#define ARRAY_SIZE 1024
erg=MultiByteToWideChar(CP_ACP, 0, text, -1, w, ARRAY_SIZE);
erg=WideCharToMultiByte(CP_UTF8, 0, w, -1, text, ARRAY_SIZE, 0, 0);
|
|
|
|
|
Souldrift wrote: char* text = new char[1024];
WCHAR w[1024]={0};
int erg=0;
Try to avoid using numbers directly or hard coding instead store in a constant.
const int SIZE = 1024;
char* text = new char[SIZE];
WCHAR w[SIZE]={0};
erg=MultiByteToWideChar(CP_ACP, 0, text, -1, w, SIZE);
erg=WideCharToMultiByte(CP_UTF8, 0, w, -1, text, SIZE, 0, 0);
So when you change SIZE, this code still keeps working.
|
|
|
|
|
Thanks. That to both of you. That works.
Problem is that I wanted to avoid a const size and instead use the variable size of m_pData (the original text). Is that possible?
Souldrift
|
|
|
|
|
Since m_pData is a string you can use string operations like strlen. Try this:
char *text = new char[strlen( m_pData ) + 1 ];
WCHAR *w = new WCHAR[strlen( m_pData ) + 1];
int erg=0;
strcpy(text, m_pData);
erg=MultiByteToWideChar(CP_ACP, 0, text, -1, w, strlen( text ));
erg=WideCharToMultiByte(CP_UTF8, 0, w, -1, text, wcslen( w ), 0, 0);
Just make sure that the strings are all NULL terminated!!
|
|
|
|
|
Hi I am using a ADO in my project. But when i compile my code i am getting the follwoing error.
error LNK2019: unresolved external symbol "long __cdecl _com_dispatch_method(struct IDispatch *,long,unsigned short,unsigned short,void *,wchar_t const *,...)" (?_com_dispatch_method@@YAJPAUIDispatch@@JGGPAXPB_WZZ) referenced in function "public: long __thiscall ConnectionEvents::InfoMessage(struct Error *,enum EventStatusEnum *,struct _Connection *)" (?InfoMessage@ConnectionEvents@@QAEJPAUError@@PAW4EventStatusEnum@@PAU_Connection@@@Z)
I have added this in my stdafx.cpp
#import "..\..\..\..\..\Microsoft\Redistribute\MSADO15.dll" no_namespace \
rename("Parameters","ADOParams") \
rename("Connection","ADOCon") \
rename("Parameter","ADOParam") \
rename("EOF", "adoEOF") \ implementation_only
and below code in my stdafx.h file
#import "..\..\..\..\..\Microsoft\Redistribute\MSADO15.dll" no_namespace \
rename("Parameters","ADOParams") \
rename("Connection","ADOCon") \
rename("Parameter","ADOParam") \
rename("EOF", "adoEOF") \ no_implementation
Please provide any comment i am not able to find out what is to be included to avoid this linking error.
|
|
|
|
|
Make sure you're linking against comsupp.lib (or some variant thereof - there's comsupp, comsuppd, comsuppw and comsuppwd) - that's where that symbol is defined. There is a #pragma in the #import process that specifies to link against that library, but it's possible, I guess, that doing the #import in stdafx negates the effect of the #pragma.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
hallo, i have the following piece of code , when i try to delete the lpKeyPoint i get HEAP CORRUPTION DETECTED!
LPPOINT lpKeyPoint;
lpKeyPoint = (LPPOINT)new LPPOINT();
GetCaretPos((LPPOINT)lpKeyPoint);
if(lpKeyPoint)
{
delete lpKeyPoint;
lpKeyPoint = NULL;
}
How can i solve this problem?
Thanks.
|
|
|
|
|
susanne1 wrote: lpKeyPoint = (LPPOINT)new LPPOINT()
That should be:
lpKeyPoint = new POINT();
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]
|
|
|
|
|
thanks it worsk,but when i move the curosor up i get a worng value of y:
CPoint* ptrKeyPoint = new CPoint();
int nCursorLine = 0;
if((pMsg->message == WM_KEYDOWN)||(pMsg->message == WM_LBUTTONDOWN))
{
if((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_UP)||(pMsg->wParam == VK_DOWN) || (pMsg->message == WM_LBUTTONUP))
{
GetCaretPos((LPPOINT)ptrKeyPoint);
nCursorLine = ptrKeyPoint->y;
}
if(ptrKeyPoint)
{
delete ptrKeyPoint;
ptrKeyPoint = NULL;
}
}
|
|
|
|
|
susanne1 wrote: when i move the curosor up i get a worng value of y:
What do you mean (i.e. details please)?
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]
|
|
|
|
|
when i press the arrow key up.
|
|
|
|
|
susanne1 wrote: when i press the arrow key up.
I think he can get that - what y value do you get ?
'g'
|
|
|
|
|
Garth J Lancaster wrote: I think he can get that
Well, it's Monday.............
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]
|
|
|
|
|
I try again: "How do you know that y value is wrong (please provide us details)?"
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]
|
|
|
|
|
the cursor stands on the second line and ptrKeyPoint->y = 32;
it sohould be 16 instead of 32 because it starts with ptrKeyPoint->y = 0; (for the first line).
|
|
|
|
|
Ummmm - just don't use the heap, OK - this should work just as well:
CPoint keyPoint;
int nCursorLine = 0;
if((pMsg->message == WM_KEYDOWN)||(pMsg->message == WM_LBUTTONDOWN))
{
if((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_UP)||(pMsg->wParam == VK_DOWN) || (pMsg->message == WM_LBUTTONUP))
{
GetCaretPos(&keyPoint);
nCursorLine = keyPoint.y;
}
See what I've done there - I've declared and defined the CPoint item as a local, so it's on the stack. Then you don't need to worry about deallocation or anything. Much simpler.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
But corrupting the heap is much more fun.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hello everyone.
I'm very new to C++. I typically stay in .NET, but I can't do this in VB.
I'm writing an Explorer replacement shell and am working on capturing the system tray icon messages. I've been able to successfully create a window and can see the icon information via WM_COPYDATA messages in WndProc. I initially tried to forward those messages on to my VB.NET app using SendMessage. That didn't work so well. Everything I got was garbage.
That has me thinking of creating a C++ Win32 DLL to create window and watch the messages. Then, using a callback function, alert the host application (my VB app) of the new data.
One problem: I don't have the foggiest idea how to write callback functions! I'm new new new to C++. I'm having enough trouble wrapping my head around having more than one type of String!
Please if someone can help, I'd really appreciate it! I need to be able to send the host application a NOTIFYICONDATA struct.
Thanks,
Ray Phillips
LCARS x32 - A Star Trek Shell
|
|
|
|
|
Hi all,
I m using CeCreateProcess function to create process in mobile like this.
for(int i=0;i<25;i++)
{
PROCESS_INFORMATION pi;
test:
if (!CeCreateProcess(
L"Test.exe",
NULL,
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
NULL,
&pi))
{
goto test;
}
else
{
WaitForSingleObject( pi.hProcess, INFINITE );
CeCloseHandle( pi.hProcess);
CeCloseHandle( pi.hThread);
}
}
when i m creating process at multiple time so after some time its return false so i m using goto to call again the process,while the process not created successfully.
can u tell me please why its return false after sometime and when i call it again n again its looks like hanged but respond after some time and create the process successfully.
i think there is some memory problem.
so please tell me how can i release the previous memory before create a new process.
if possible please explain me with example.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|