|
As I said in my last post, I've already corrected this compiler error and still the same problem.
Sorry
Doc
|
|
|
|
|
This works,
<br />
TCHAR m_szDrive[10];<br />
TCHAR m_szDir[MAX_PATH];<br />
TCHAR m_szFullPath[MAX_PATH];<br />
CString sFile; <br />
::GetModuleFileName(NULL,m_szFullPath,MAX_PATH);<br />
_splitpath(m_szFullPath,m_szDrive,m_szDir,NULL,NULL); <br />
sFile=m_szDrive;<br />
sFile+=m_szDir;<br />
sFile+=_T("myfile.txt");<br />
HANDLE h = ::CreateFile ( sFile,<br />
GENERIC_WRITE,<br />
FILE_SHARE_READ,<br />
NULL,<br />
OPEN_ALWAYS,<br />
FILE_ATTRIBUTE_NORMAL,<br />
NULL ) ;<br />
Given that your code appears to compile the problem is probably down to the arguments to 'CreateFile'. What are you using?
Paul
|
|
|
|
|
Anybody out there have this very frustrating problem?:
When I build my project, Visual often hangs and I have to kill the Visual C++.NET process and start over. It happens on a regular basis and the "Stop build" button does not work. It is very frustrating!!!
|
|
|
|
|
when accessing from another process.
All variables have not null values.
void getMenuItem(HWND hWndMenu)
{
HMENU menu = GetMenu(hWndMenu);
MENUITEMINFO mi, *_mi; unsigned long pid;
HANDLE process;
GetWindowThreadProcessId(hWndMenu, &pid);
process=OpenProcess (PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, FALSE, pid);
_mi=(MENUITEMINFO*)VirtualAllocEx(process, NULL, sizeof(MENUITEMINFO), MEM_COMMIT, PAGE_READWRITE);
ZeroMemory(&mi, sizeof(MENUITEMINFO));
mi.cbSize = sizeof(MENUITEMINFO);
mi.fMask = MIIM_TYPE;
mi.fType = MFT_STRING;
mi.dwTypeData=NULL;
WriteProcessMemory(process, _mi, &mi, sizeof(MENUITEMINFO), NULL);
// this fails GetMenuItemInfo(menu, 1, true, _mi);
ReadProcessMemory(process, _mi, mi, sizeof(MENUITEMINFO), NULL);
int size = mi.cch;
VirtualFreeEx(process, _mi, 0, MEM_RELEASE);
|
|
|
|
|
I have an app that I recently opened a copy of in .Net to try to finish with .Net capabilities. Everything works fine so far, except that when I close the app, I get the following error message:
Unhandled exception at 0x00130276 in FB.exe: 0xC0000005: Access violation reading location 0x0099139c.
It's indicating the Bolded line in the following function (which I have never touched):
CRichEditCntrItem* CRichEditView::GetInPlaceActiveItem() const
{
ASSERT(m_lpRichEditOle != NULL);
CRichEditDoc* pDoc = GetDocument();
CRichEditCntrItem* pItem = NULL;
CReObject reo;
HRESULT hr = m_lpRichEditOle->GetObject(REO_IOB_SELECTION, &reo,
REO_GETOBJ_ALL_INTERFACES);
if (GetScode(hr) == S_OK && (reo.dwFlags & REO_INPLACEACTIVE))
{
pItem = pDoc->LookupItem(reo.poleobj);
if (pItem == NULL)
pItem = pDoc->CreateClientItem(&reo);
ASSERT(pItem != NULL);
}
return pItem;
}
Does anyone have any idea what's the problem? I'm very new to .Net and have no clue.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
I have two VB apps in which I need to send a PeopleID from one app to another. If the 2nd app is closed, I could probably just specify it as a command-line argument. But what if the app is already running? Is there a way that I can do this in a dll?
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Hi. I'm looking for some hints (code) that will allow me add new rules to OE and add new Folder.
Thanks
Pain is a weakness living the body
|
|
|
|
|
Hi,
I have wrote a progrm that process word documents. I want to skip processing the password protected word documents.
How to find a word document is password protected, with out opening the document?
Thanks,
GTS
GTS
|
|
|
|
|
If you are using Word's COM interface (i.e., automation), then any attempt at opening a file with a missing/invalid password will fail. You can use such a return code to know whether to skip the file or not.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi
Using either Add method or Open method not causes the failure, it simply stalls the execution. Any idea?
Thanks,
GTS
|
|
|
|
|
Please mention the programming language you are using.
Gurmeet S. Kochar
If you believe in God, it's because of the Devil
|
|
|
|
|
Hi,
I am using VC++ and COM library of MS Word.
Thanks,
GTS
|
|
|
|
|
Hi, I need to extract every information I can from ADSL modem(speed,SRN..) (best using tellnet). How to do this or what functions to use? Thanks in advance.
|
|
|
|
|
I doubt that you can. While dialup modems have de facto standards for communications (the Hayes AT command set) I have been unable to find any such common interface for ADSL modems. Of the dozen or so that I've used, no two used the same command line interface (CLI) - the cheaper ones didn't even have one, relying entirely on a built in web page for setting and retrieving configuration information. If you discover such a standard it would make for a great article here, though!
Will Build Nuclear Missile For Food - No Target Too Small
|
|
|
|
|
I ned to detect moment when all operation on
Creation and Showing window is finished,
and window ready to work and working ?
Also what message window receives when othr window moves
over it ?
Thanks
|
|
|
|
|
vgrigor wrote:
Creation and Showing window is finished,
and window ready to work and working ?
I dont think there is a any that kinda message, but there is a workaround for this...
If i assume that you are talking about dialog window.
You need to do the following steps.
1.Define a custom window
#define WM_MYMESSAGE WM_USER + 1
2.Then at the end of the OnInitDialog you post this message
PostMessage(WM_MYMESSAGE,0,0);
3. Add a message handler for the message in the message map.
...
ON_MESSAGE(WM_MYMESSAGE,OnMyMessage)
...
4. Implement the function.
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
I had a similar problem when starting up a program (Acrobat Reader) and wanted to wait until it had finished convulsing before trying to diddle it. I stumbled upon WaitForInputIdle() . Here is a working example of using it:
STARTUPINFO startupInfo;
PROCESS_INFORMATION processInfo;
::ZeroMemory(&startupInfo, sizeof(startupInfo));
startupInfo.cb = sizeof(startupInfo);
::ZeroMemory(&processInfo, sizeof(processInfo));
char cmd[MAX_PATH + MAX_PATH + 5];
sprintf(cmd,"\"%s\" \"%s\"", szExe, pdfFile);
BOOL startedOK = CreateProcess(
NULL,
cmd,
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&startupInfo,
&processInfo);
if(!startedOK)
{
ShowLastError(cmd);
return;
}
<big>WaitForInputIdle(processInfo.hProcess,INFINITE);</big>
Of course, this is assuming the windows you're interested in are in another process...
|
|
|
|
|
Imagine, if such a mad people will decide how to
hang on real people really ?
(Biting infinite)
average dog is better. Only want to bite once.
|
|
|
|
|
i guess PeekMessage can be used for this purpose.
Gurmeet S. Kochar
If you believe in God, it's because of the Devil
|
|
|
|
|
I developed an database application using VC++ and Micorsoft Access driver as the ODBC source. There are 2 threads in the application both accessing the same table. The first thread writes data in the table and the second thread reads and deletes data from the table. Here is a snapshot of the code of the second thread:
while (!attackRecSet->IsEOF())
{
.
.
.
.
.
.
try
{
attackRecSet->Delete();
attackRecSet->MoveNext();
} //try
catch(CDBException *e)
{
MessageBox(NULL, e->m_strError, "Error", MB_OK);
e->Delete();
} //catch
} //while
An error message occurs because of the delete function and the thread stops working. the error message is:
" Could not update; currently locked by user 'admin' on machine ISLAM_COMPUTER'. "
and when I press OK the following message occurs for ever (it reoccurs if I press the OK button):
" Invalid cursor position; no keyset defined. "
If I commented the delete function the thread will work perfectly. I searched the MSDN for an explanation but with no use. Could anyone tell where could I find an explanation for this error.
Islam Hegazy
islam
|
|
|
|
|
You need to use syncronization objects like Mutex or CriticalSection to ensure that only one thread works with the database system.
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
Hi all!
In my aplication I have an edit box (1) where the user can add text that will appear in other edit box (2). In (2) each text is concatenated with prior one, but when I try to concatenate "\n" so the next text appear in a new line, I get a strange character between two texts instead of a new line. The edit box (2) is a read-only one and Want_Return mode is selected. How could I concatenate the texts so each one appears in new lines?
Thank you in advance.
|
|
|
|
|
satcat wrote:
...I get a strange character between two texts instead of a new line.
Are you using the ES_MULTILINE style?
satcat wrote:
How could I concatenate the texts so each one appears in new lines?
Use \r\n instead.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
You need to use ES_MULTILINE style and should append "\r\n", rather than just the line feed.
onwards and upwards...
|
|
|
|
|
In a function i am doing following things
Function starts
<br />
CBitmap *pWFRBitmap = pDoc->m_Analyzer.GetWFRBitmap();<br />
pWFRBitmap->CreateCompatibleBitmap(&ClientDC, 860, 1100);<br />
ClientDC.SetMapMode(MM_LOENGLISH);<br />
<br />
CDC MemDC;<br />
MemDC.CreateCompatibleDC(&ClientDC);<br />
MemDC.SelectObject(pWFRBitmap);<br />
MemDC.SetMapMode(MM_TEXT);<br />
MemDC.SetMapMode(MM_LOENGLISH);<br />
Function ENds
1.0 What exactly will happen. To the bitmap in CAnalyser and MemDC. Will the content of MemDC will be written to CBitmap which is attached to MemDC.
2.0 What will happen if every thing remains same and i make CDC MemDC global?
3.0 I want to make another function in CAnalyser like SetBitmap and want to assign the content of the CDC MemDC (global) to assigned to that CBitmap member of CAnalyser m_WFRBitmap so that i can draw the bitmap again whenever my screen get redrawn instead of carrying out complete drawing process again and again.
How to do this?
Leave your mark wherever you go
|
|
|
|
|