|
You may have passed an invalid pointer or you may be over writting memory in an earlier function call. The last time I saw this error I had to back track until I found a miscalulated value that was causing an over write. This error normaly appears after the cause of the error (some times long afer).
INTP
|
|
|
|
|
|
Hi,
In my sdi application I have 2 tree views selectable by tabs. If I minimize and maximize the application the tree view looks grayed, only the selected node being visible. Can anyone tell me why and how to fix this?
|
|
|
|
|
There can be a range of issues here. Here are some things you can try:
One, make sure when one is made visible, the other is made invisible.
Two, the tab or the dialog may be drawing it's background on top of the tree controls. Try setting the tab or dialogs properties to clip children.
Three, detect the WM_ACTIVATE and do a RedrawWindow on the visible tree.
--
Joel Lucsy
|
|
|
|
|
Thanks a lot!...Redrawwindow() worked.
|
|
|
|
|
Hi,
how do I achieve the following:
I want to right click on a file and go to Open with and select my SDI application and it would be opened in my application the way it gets opened by File | Open etc.
Please advise
|
|
|
|
|
shell extensions
see michael dunn's articles here on cp
they are awesome
"there is no spoon" biz stuff about me
|
|
|
|
|
How can i de style of single cells in the MFC grid so that they convert all input to uppercase.
Change the style of the InPlaceEditControl ??
Luc Devriendt
|
|
|
|
|
Hi, sorry that this might be a beginner question.
I know how to get a pointer form View class to doc class.
But how do you get a pointer from app class to doc class? is there a way? If not can you get a pointer to app class from doc class?
Thanks for your help
Q-Bus
|
|
|
|
|
from the app, I believe you can call GetActiveView() or something.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Do the following:
1.Add a member variable to your app class
CYourDoc* m_pYourDoc;
2.Add a memeber function to your app class:
SetYourDoc(CYourDoc* pYourDoc)
{
m_pYourDoc = pYourDoc;
}
3.In your doc class' constructor call
theApp.SetYourDoc(this);
Peter Molnar
|
|
|
|
|
|
Hi! I'm working on a program that opens JPEG images and i'm using GDI+ to do this. Everything was working fine until i tried to create a zoom feature. ScaleTransform() somehow causes horrible flickering. I'm using CMemDC for doulbe buffering which works fine if you view the image at 100% size. Even the scrollbars get sluggish the flickering is so bad. What could be causing this and is there a non-flickering way to do zoom?
-- Steve
|
|
|
|
|
I am not sure this is a GDI+ problem.
Possible causes:
1) failure to over ride CWnd::OnEraseBkgnd() (a.k.a. WM_ERASEBKGND).
2) not drawing the entire client content a memory DC before blitting it to the screen (kind of slow).
When displaying rectangular images that require updating/zooming etc..., I use the following method.
1) Override OnEraseBkgnd() to return TRUE.
2) In OnDraw(): (1) draw the image, (2) then call pDC->ExcludeClipRect() to exclude the drawn image rectangle from furthur drawing, then (3) draw the background (pDC->FillSolidRect(&rectClient, ::GetSysColor(COLOR_WINDOW));).
There are aticles on GDI+ and flicker free drawing at codeproject.
INTP
|
|
|
|
|
Hello,
I want to have more than 1 socket connections to
a port/IP address.
In CAsyncSocket::SetSockOpt(int nOptionName, const void* lpOptionValue,
int nOptionLen, int nLevel = SOL_SOCKET );
What is the value of nOptionName that I should provide for the
function, and how about the lpOptionValue, nOptionLen?
I should call this function before the call to
CAsyncSocket::Create(iPort, SOCK_STREAM, FD_READ | FD_WRITE |
FD_CONNECT | FD_CLOSE, NULL);
or after it.
For now, when I call the Create(), I always get the error code
10048 (WSAEADDRINUSE = Address already in use)
If possible, do you have any short sample to use this to make
connection to the socket that is already in use.
Thanks a lot!Hello,
I want to have more than 1 socket connections to
a port/IP address.
In CAsyncSocket::SetSockOpt(int nOptionName, const void* lpOptionValue,
int nOptionLen, int nLevel = SOL_SOCKET );
What is the value of nOptionName that I should provide for the
function, and how about the lpOptionValue, nOptionLen?
I should call this function before the call to
CAsyncSocket::Create(iPort, SOCK_STREAM, FD_READ | FD_WRITE |
FD_CONNECT | FD_CLOSE, NULL);
or after it.
For now, when I call the Create(), I always get the error code
10048 (WSAEADDRINUSE = Address already in use)
If possible, do you have any short sample to use this to make
connection to the socket that is already in use.
Thanks a lot!
TQD
|
|
|
|
|
A socket can only be created once, so if you or another program has already created it then you will receive the 'in use' error code. A socket can accept multiple connections, once created, and this can be controlled by the parameter given in the 'Accept' function.
|
|
|
|
|
uhhhh -- what are you passing in as iPort?
If you pass in 0, you can create as many connections as you need.
A connection is defined as a source port/ip paired with a destination port/ip. if the source and the destination are reused, you'll get ADDRINUSE.
Passing in 0 as the port (source port) causes the TCP stack to allocate the source port for you... letting you make many.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
plz try to use setsockopt() function with SO_REUSEADDR
SOCKET sock;
BOOL bReuse = TRUE;
....
setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&bReuse,sizeof(int));
...
bind(...);
|
|
|
|
|
How to show a modal dialog in multithread app?
I want to show a modal dialog in multi thread application.
But when I show the dialog as the fllowing, VC shows
"Debug Assertion Failed" dialog. Anyone knows how to
do it? Thanks very much.
CAboutDlg dlg;
dlg.DoModal();
The attachment is a demo.
testmultithread.zip
|
|
|
|
|
Hi LaoWei.
First, there is a little bug in your CreateMultiThread :
void CTestMultiThreadApp::CreateMultiThread()
{
DWORD tID;
g_nIndex[1] = 0;
::CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc, (LPVOID)&(g_nIndex[0]), 0, &tID);
g_nIndex[1] = 1;
::CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc, (LPVOID)&(g_nIndex[1]), 0, &tID);
} Second, you use CreateThread in conjunction with MFC. This is dangerous. If your thread uses MFC support it should always be created via AfxBeginThread . Knowing this, you can write CreateMultiThread as follows:
void CTestMultiThreadApp::CreateMultiThread()
{
DWORD tID;
g_nIndex[0] = 0;
AfxBeginThread((AFX_THREADPROC)afxThreadProc,(LPVOID)&(g_nIndex[0]));
g_nIndex[1] = 1;
AfxBeginThread((AFX_THREADPROC)afxThreadProc,(LPVOID)&(g_nIndex[1]));
} Now your "Debug Assertion Failed" is gone bye bye...
RK
|
|
|
|
|
How does one go about getting the number of files in a directory with VC++?
Thanks for any help.
|
|
|
|
|
|
Thanks for your reply; but it only finds files not give you a total file count in a dir.
|
|
|
|
|
Here's an example using MFC CFileFind.
<br />
#include <afx.h><br />
<br />
void main()<br />
{<br />
CFileFind find;<br />
BOOL notdone = find.FindFile("E:\\test\\*.*");<br />
int files = 0;<br />
int directories = 0;<br />
<br />
if (!notdone)<br />
printf("No files found\n");<br />
<br />
while (notdone)<br />
{<br />
notdone = find.FindNextFile();<br />
<br />
if (find.IsDots())<br />
continue;<br />
<br />
if (find.IsDirectory())<br />
directories++;<br />
else<br />
files++;<br />
}<br />
find.Close();<br />
printf("Files:\t%d\n", files);<br />
printf("Directories:\t%d\n", directories);<br />
}
Greba,
My lack of content on my home page should be entertaining.
|
|
|
|
|
Thank you for the code example. Is there a API that supplies us with the file count in a directory?
|
|
|
|