|
I hope you all've used MSN messenger. The window/GUI of MSN messenger is customizable and there are many custom add-ons present. I mean that we can customize the window of MSN messenger without having the access to the original source code.
I also want to make my window based application that i can customize later without accessing the original source code, just like MSN messenger. Can any one tell me how such applications are created ???
|
|
|
|
|
I am having a problem with a Combobox that I have on a dialog. I am attempting to populate the ComboBox from records in a mdb database. I can get the recordset open just fine and when I attempt to put the items into the ComboBox I get one of two errors:
CB_ERR or CB_ERRSPACE
I have tried using both AddString and InsertString and I get the same errors. I am only attempting to insert about 5 items currently. I have tried to allocate space using the InitStorage method and I can only get about 10 bytes allocated.
My systems has 512MB of Ram and has about 61% of systems resources available.
Here is the code snipet for the getting the data in from the recordset:
<br />
if(!rsLocation.Open())<br />
MessageBox(_T("Error opening the Locations Table!"), _T("Initialization Error"), MB_ICONEXCLAMATION);<br />
else<br />
{<br />
while(!rsLocation.IsEOF())<br />
{<br />
CString strLocation = rsLocation.m_LocationName;<br />
if(m_cLocation.AddString(strLocation) == CB_ERR || CB_ERRSPACE)<br />
{<br />
MessageBox(_T("Error adding locations!"), _T("Initialization Error"), MB_ICONEXCLAMATION);<br />
break;<br />
}<br />
else<br />
{<br />
rsLocation.MoveNext();<br />
nRowNum++;<br />
}<br />
}<br />
rsLocation.Close();<br />
}<br />
Any ideas why this fails?
Thanks,
-Eric
|
|
|
|
|
I am trying to implement window snapping in an SDI application. The code I'm using (http://www4.ncsu.edu/~jgbishop/codetips/snapwindow.html) works fine when I place it in the CMainFrame class. However, I allow the user to set a custom snap distance. This is done via the options dialog, which is opened from my CFormView class.
My main problem is that I cannot seem to access this needed CFormView variable from my CMainFrame class. If I could do that, things would work like I want them to. Anyone know how to do that?
If that is not possible, is there some way to trap messages sent to the CMainFrame in my CFormView class? Perhaps some sort of message routing mechanism that I could use? I need to trap the WM_MOVING and WM_ENTERSIZEMOVE events for my SDI application window, but it seems that I can only do that from the CMainFrame class (not from CFormView).
If anyone has a solution to either of these problems, I would be very grateful!
Jonah Bishop
Visit JGB Productions
http://www4.ncsu.edu/~jgbishop
|
|
|
|
|
Store the snap distance in CMainFrame and make a public accessor SetSnapDistance() . The view can then call
((CMainFrame*) AfxGetMainWnd())->SetSnapDistance(new_distance);
as needed.
--Mike--
"alyson hannigan is so cute it's crazy" -- Googlism
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Thanks Michael! This is just what I needed...
Jonah B.
Jonah Bishop
Visit JGB Productions
http://www4.ncsu.edu/~jgbishop
|
|
|
|
|
hi all,
i want to know the result or problem if i access same function with 2 threads as following
class A
{
public:
A()
{
AfxBeginThread(threadA, this...);
AfxBeginThread(threadB, this...);
}
static uint threadA(LPVOID ptr)
{
A* pA = (A*) ptr;
pA->commandfunction();
}
static uint threadB(LPVOID ptr)
{
A* pA = (A*) ptr;
pA->commandfunction();
}
void commonfunction()
{ ... }
}
int main()
{
A a;
}
what will happen if threadA, threadB access commonfunction() at the same time?
as i know, they should access same copy of commonfunction().
will there any corruption?
pls give me some idea!
thanks,
jim
|
|
|
|
|
Each thread has one copy of the stack, so if depends of what you do in the common function, if you access a global or static (I don't recommend these 2 approaches) variable, then yes , you could have troubles , if you access a shareable variable that is updated based on some common work, let's say a inserting/removing elements of the queue , then you also should protect it , to prevent data corruption/race conditions ...
If you want to pass data to the function is normal to pass a struct with the data that you want to access, plus a condition variable or a mutex(interprocess visibility) to protect your access to it ...
HTH
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
actually, i read some articles on multithread programming.
i know it need to use CriticalSection, Mutex to protect data member from being accessed by more than a thread per times.
however, i don't so sure the problem on member functions.
u have mentioned about one copy of stack per thread. what will it affect when thread access a member function?
thanks,
jim
|
|
|
|
|
For instance Thread A calls func that modifies array x, that is a normal instance member variable of the class Xpto.
x[i++]=dumbValue;
Thread B calls func that modifies array x
x[i++]=dumbValue;
Another thread or other function or ... reads the value
y=x[i];
What is the value, the value added by thread A, or thread ?
If you count on a specific order , you could get in trouble with this, in this case you must protect array x to be thread safe and to serialize access, to maintain data in a coerent and expected state , get it ?
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
you are talking about kind of global or class member variable.
but, what will happen for local variable inside a function?
used my example, here is the implementation of commonfunction() in my question
void commonfunction()
{
for(int i=0; i<100;i++)
{
i= i+i;
}
printf("%d", i);
}
if both thread A and B access commonfunction()
will local variable, 'i' corrupt?
thanks,
jim
|
|
|
|
|
Anonymous wrote:
if both thread A and B access commonfunction()
will local variable, 'i' corrupt?
No, because as I said, each thread has their own stack, so each thread have independent copies of the local variables
So, the loop is performed two times independently by the two threads.
This function is also reentrant, because it don't use static neither global variables.
Resumming , no problems at all if you only use local variales
HTH
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
I have done a db program.Using ado to access oracle806 db,I used Oracle OleDB provider to improve performance.
It's fine on my pcs(xp/98,oracle 817 client) .However ,
After release it(using vc++6.0 install shield),it does not work on some pcs.It seem program do not connect to oracle.
On others,it work well.Try connecting the oracle with SQL*PLUS,i find the net8 is ok.What's wrong with my program? I suppose the program is Oracle OleDB provider.
Help me ,please.
|
|
|
|
|
sages wrote:
,I used Oracle OleDB provider to improve performance.
The Microsoft one is slower, but it doesn't leak memory. If you tie yourself to it now, you'll have a slower, but more reliable database.
sages wrote:
I suppose the program is Oracle OleDB provider.
Probably, yes. Be careful though - every Oracle patch comes with the full Oracle installation program, and running a patch could mean you can not ever remove Oracle using an uninstaller, plus it's almost certain that the Oracle Enterprise Manager will stop working on the machine in question. The same is true if you do an MDAC upgrade, but 2.7 does fix the memory leak I mentioned earlier ( at the expense of never being able to run the Enterprise Manager again ).
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
The Oracle OLEDB provider has been changed to MS OLEDB provider.It's OK.Thanks you for your help.good luck to u.
|
|
|
|
|
Hyello,
I have a Wizard in my application which works flawlessly on Windows 2000/Xp, but under Windows 98, I get some weird stuff going on. On some pages, when you hit the Next button, it advances either back to the beginning, or some other page other than the next one --- though it does work sometimes.
Has any run into this problem? I've been trying to trace the problem through in Windows 98, but the whole os tends to lock up and it's really frustrating!
Thanks!
swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
can anyone tell me how i can disable selection of individual rows of a listctrl.
if u suggest ODS_DISABLED
please elaborate
cause i cant get it to work properly..
|
|
|
|
|
i believe you have to implement this yourself
swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
do u remember the vstudio 6 help
the msdn then had the index and u could filter the list box accoring to language like for vc vb ...etc..and according to the filter all the contents not in that language would be disabled(grayed out)..
thats the kind of thing im talking off..
do umean to say that that not possible standardly and has to be implemented seperately??
|
|
|
|
|
yep, as far as i know. it's not that hard to do though... there's a bunch of articles on how to do stuff like this here in codeproject. you could also do a search for CListCtrl::DrawItem().
cheers,
swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
Handle LVN_ITEMCHANGING. Examine the iItem and uNewState members of the struct you are passed, and if an item is becoming selected, and you don't want it to be, return TRUE from the handler to prevent the change.
--Mike--
"alyson hannigan is so cute it's crazy" -- Googlism
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
please elaborate if possible
a code snipet would be helpful
|
|
|
|
|
I have never gotten an error in release mode that I did not get in debug mode. In CView::OnFilePrint() somewhere between OnBeginPrinting and OnPrepareDC (the two functions I can override and put some message boxes in so I can see where I am while in release mode) I am getting this:
Unhandled exception at 0x0050f277 in Paradigm.exe: 0xC0000005: Access violation reading location 0x00000002.
I have exhausted my knowledge trying to figure out why this is happening.
I can set a breakpoint for this address and it hits it three other times during execution before it bombs in OnFilePrint(). VS says there is no source code associated with this address. The dissassembly is as follows:
0050F277 66 81 7B 02 FF FF cmp word ptr [ebx+2],0FFFFh
Where do I go from here? I'm sure there are things to do that are outside my knowledge base. It works perfectly in debug mode.
Ed
|
|
|
|
|
There is a good article here on CP about how to fool the debug version into thinking it's a release version, so you can catch these errors in the debugger.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Greetings all,
I have a question. I'm using Norm Almond's CLabel control on a Property Page. I want to allow the user to select some colors and then have a rectangle on the dialog with the color the user chose. It was working perfectly as a CDialog.
What's happening now is I'm trying to make that dialog a PropertyPage as part of a PropertySheet. Here are the changes I made to InitInstance:
BOOL CPropertySheetDemoApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
/*CPropertySheetDemoDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}*/
CPropertySheet mySheet;
CMyPropertyPage myDemoPage;
myDemoPage.m_lblTest.SetBkColor(RGB(1.0, 1.0, 1.0));
mySheet.AddPage(&myDemoPage);
mySheet.DoModal();
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
As you can see I just commented out the stuff to bring up the initial dialog and am trying to bring up the property sheet instead. The error I'm getting is a debug assertion failure in the UpdateSurface() method of the CLabel class. It seems to be complaining that the window hasn't been drawn or doesn't have an hWnd yet.
Any suggestions? I just want to be able to initialize the colors on the labels as they come up, and they may not always be the same colors.
I'd appreciate any suggestions!
Joe
|
|
|
|
|
Hi!!
I have a connection between two computers, that work's OK. Command NETSTAT show the ESTABLISHED status under this connection, but I need to receive from a third computer. On the 3rd computer, the NETSTAT command show the ESTABLISHED status too, but the CSocket::Receive from the server, can not listen from there...
what was wrong?
Thank's.... Walote
|
|
|
|
|