|
HI, I have found the error is not the software but the edgeport/4S USB serial port hardware I am using. I tested the software on a direct RS232 port and it worked correctly. I have since found that re-installing the edgport/4s 4 port unit and then re-instating RS422 has fixed the problem.
|
|
|
|
|
Hi all !!
I practise VC. When I code my program to create a file.
The first time when I click my button2 (create file) I receive a error "access pathdir to file is denied" but I can create file at the second click. I don't know why ??? Please,I need help !!
This's my code when click button2, I use MFC wizard (use dialogbase)
void CTestDlg::OnButton2()
{
// TODO: Add your control notification handler code here
char filename[100];
GetCurrentDirectory(100,filename);
strcat(filename,"\\RongVang.dat");
CFile f;
if(!f.Open(filename,CFile::modeReadWrite))
f.Open(filename,CFile::modeCreate);
f.SeekToEnd();
char s[100];
strcpy(s,"Test Create file");
f.Write(s,100);
}
-- modified at 22:36 Sunday 16th October, 2005
|
|
|
|
|
the filename return format is not like this"C:\\ adir"
it return format is "C:\adir"
it can't use as a parameter in F.Open Function .
d
|
|
|
|
|
Thank so much !!
But how can i slove it ....
Can you show me .....
I've just program...
|
|
|
|
|
Why do you open the file two times?
i think there you get the error.
if(!f.Open(filename,CFile::modeReadWrite))<br />
f.Open(filename,CFile::modeCreate);<br />
Try this:
if(!f.Open(filename,CFile::modeCreate | CFile::modeReadWrite))
|
|
|
|
|
if(!f.Open(filename,CFile::modeCreate | CFile::modeReadWrite)) f.Open(filename,CFile::modeCreate);
The first click it will create file.
I want at the second click, third,4,5,.... click in button2, it will append my file, not delete and create new file like above !!
Can you help me ... !!!!!!!!!!!!
|
|
|
|
|
CString filename = _T("C:\\RongVang.txt");<br />
CStdioFile f;<br />
if(!f.Open(filename,CFile::modeReadWrite))<br />
f.Open(filename,CFile::modeCreate|CFile::modeReadWrite);<br />
f.SeekToEnd();<br />
CString s = _T("Test Create file\n");<br />
f.WriteString(s);<br />
dont forget to close your file.
|
|
|
|
|
vhazell wrote: I want at the second click, third,4,5,.... click in button2, it will append my file, not delete and create new file like above !!
Then use:
if (f.Open(filename, CFile::modeCreate | CFile::modeReadWrite | CFile::modeNoTruncate) != FALSE)
{
f.SeekToEnd();
...
}
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi, i'm new around and i have a big problem. i have to make a program to log msn conversations into .txt files and i'm having trouble doing it. this is going to be my final college project so i need it to work before december
i found an article here in code project on how to retrieve conversations based on the windows title, i already fixed the code like this to get all the windows titles an display a textbox when it founds a conversation window. right now i'm sending all the windows names to a list box while i develop the whole app
<br />
OnInitDialog(){<br />
...<br />
EnumWindows(EnumWindowCallBack, (LPARAM)::GetDlgItem(m_hWnd, IDC_LIST_RUNNING));<br />
...<br />
}
static BOOL CALLBACK EnumWindowCallBack(HWND hwnd, LPARAM lParam) <br />
{ <br />
HWND hWnd = (HWND)lParam; <br />
CString strTitle;<br />
DWORD wndPid;<br />
<br />
if (IsWindowVisible(hwnd))<br />
{<br />
GetWindowThreadProcessId(hwnd, &wndPid);<br />
CWnd::FromHandle(hwnd)->GetWindowText(strTitle);<br />
strTitle.TrimRight();<br />
if (!strTitle.IsEmpty())<br />
{<br />
CListBox *pListBox = (CListBox *)CWnd::FromHandle(hWnd);<br />
pListBox->AddString(strTitle);<br />
if((strTitle.Find("- Conversation",0))!=-1){<br />
::MessageBox(hWnd,"Found","MSN",MB_OK);<br />
EnumChildWindows(hWnd, ChildWndProc,0);<br />
}<br />
}<br />
}<br />
<br />
return TRUE; <br />
}
the function that it's supposed to retrieve the text from the conversation windows is
<br />
static BOOL CALLBACK ChildWndProc(HWND hwnd, LPARAM lParam){<br />
static int i = 0;<br />
LPTSTR lptstr;<br />
HGLOBAL hglb;<br />
char windowclass[CLASS_SIZE];<br />
<br />
if(GetClassName(hwnd,windowclass,CLASS_SIZE)==0)<br />
return TRUE;<br />
<br />
string strTemp(windowclass);<br />
if((strTemp==string("RichEdit20W")) || (strTemp==string("RichEdit20A"))){<br />
::SendMessage(hwnd,EM_SETSEL,0,-1);
::SendMessage(hwnd,WM_COPY,0,0);<br />
::SendMessage(hwnd,EM_SETSEL,-1,0);
<br />
if (!IsClipboardFormatAvailable(CF_TEXT)) <br />
return TRUE; <br />
<br />
if (! ::OpenClipboard(NULL)) <br />
return TRUE; <br />
<br />
hglb = GetClipboardData(CF_TEXT); <br />
if (hglb != NULL) <br />
{<br />
lptstr = (LPTSTR)GlobalLock(hglb); <br />
GlobalUnlock(hglb); <br />
EmptyClipboard();<br />
CloseClipboard();<br />
::MessageBox(hwnd,lptstr,"MSN",MB_OK);<br />
pChatText->SetWindowText(lptstr);<br />
<br />
return FALSE;<br />
}<br />
}<br />
return TRUE;<br />
}
when i compile and run the program i don't get any errors or warnings but it doesn't retrieve any conversation.
i just can't figure out what's wrong or if this code just doesn't do the work.
i'm using Visual C++ 6.0 SP6 on W2K and MSN messenger 7.0.0813 to do this app
could somebody tell me what's wrong with that code in order to do the rest of the app or tell me if there's another way to retrieve msn conversations?
any help is really appreciated
|
|
|
|
|
smargada wrote: i'm using Visual C++ 6.0 SP6 on W2K and MSN messenger 7.0.0813 to do this app
Now MSN messenger no longer contain the RichEdit box.. so you can't reterive the conversation text using above method... any way you can try this link
Hooking MSN COM interface[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
ThatsAlok wrote: Now MSN messenger no longer contain the RichEdit box...
What version? I'm using Windows Messenger v4.7 and it definitely uses rich edit controls.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: I'm using v4.7 and it definitely uses rich edit controls.
Sir,
So Sorry, I am quoting on SmagGada remark in his/her post that he/she needs to reterive chat message MSN messenger 7.0. Sir, I believe you are using Window Messenger, it's still using same old RichEdit Ctrl for chat message!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
how do you install your app as a service one windows xp?
|
|
|
|
|
ServiceProjectName.exe /install
d
|
|
|
|
|
i dont think you understand what i'm asking..
i wan't to know how to programmatically add an application that i made as a service...
|
|
|
|
|
ummmmmm run the command mentioned above as a separate process so it installs?
CreateProcess(...)
"there is no spoon" {biz stuff} {about me}
|
|
|
|
|
Archer282 wrote: i wan't to know how to programmatically add an application that i made as a service...
use this api CreateService()
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
thank you!!, that's exactly what i was looking for..
|
|
|
|
|
Hello,
I'm building owner drawn menus and when using this
ImageList_DrawEx( himl, this->m_nIcon, lpdis->hDC, x, y, 0, 0, CLR_NONE, RGB(128,128,128), ILD_BLEND50 );
The icon color is only dimed, but not blended with the specified RGB color and yes my icon has a mask as I can draw it with ILD_MASK and I see a black icon painted which is the mask.
Piece of MSDN help
---------------------
rgbFg
Foreground color of the image. This parameter can be an application-defined RGB value or one of the following values:
CLR_NONE - No blend color. The image is blended with the color of the destination device context.
CLR_DEFAULT - Default foreground color. The image is drawn using the system highlight color as the foreground color.
fStyle
Drawing style and, optionally, the overlay image. For information about specifying an overlay image index, see the comments section at the end of this topic. This parameter can be a combination of an overlay image index and one or more of the following values:
ILD_BLEND25,
ILD_FOCUS
Draws the image, blending 25 percent with the blend color specified by rgbFg. This value has no effect if the image list does not contain a mask.
ILD_BLEND50,
ILD_SELECTED,
ILD_BLEND
Draws the image, blending 50 percent with the blend color specified by rgbFg. This value has no effect if the image list does not contain a mask.
-------------------
Note: Using Win32 API, no MFC
Thanks
David
-- modified at 17:25 Sunday 16th October, 2005
|
|
|
|
|
ClickHeRe wrote: ImageList_DrawEx( himl, this->m_nIcon, lpdis->hDC, x, y, 0, 0, CLR_NONE, RGB(128,128,128), ILD_BLEND50 );
The icon color is only dimed, but not blended with the specified RGB color
You realize that you're blending with medium gray, right? This is usually going to cause some dimming...
|
|
|
|
|
I tried with plain RGB(255,0,0) and the icon only dimmed, never turned redish
|
|
|
|
|
I looked into this a bit, and have discovered that if you are using a manfiest (so that your program uses the v6 common controls on XP), ImageList_DrawEx() is broken, just as you found. Without the manifest (or on Windows versions prior to XP), the function works as documented, dithering the foreground color over the image.
Interestingly, ImageList_Draw() works fine, blending the system highlight color with the icon.
|
|
|
|
|
Any thoughts on a function or way to achieve the same sort of end result and that would work on any machine.
I want to grey the disabled icon and possibly apply this technique on other cases on the menus like normal unselected icons making the selected one the only true color icon.
Thanks
David
|
|
|
|
|
There is an article here you should read then:
CreateGrayScaleIcon
A nice little function that creates a sharp-looking grayscale version of whatever is passed in. Also, it's pretty easy to modify the function to do other image manipulation on icons.
|
|
|
|
|
I posted this question a few days ago here but I never got a response so I'll try again.
I have a program I wrote, it's more or less done. The problem is after I run it through VS, my program slows down considerably and I click stop and I get a lot of the messages:
First-chance exception at 0x7c81eb33 in myprogram.exe: Microsoft C++ exception: CResourceException @ 0x0012f660. Warning: Uncaught exception in WindowProc (returning 0).
I know how to handle exceptions but the code is too distributed to know what is causing the problem. Is there a way to figure out those addresses that's causing the exceptions so I can deal with them?
|
|
|
|
|