|
|
It's probable that NT offered different mapping modes, GDI changes a lot between releases of windows, but do you really think they would release a new version of windows that does not run all the software written before for previous versions ? Who would buy it ?
Don't install any SDK's if you're targeting W95, otherwise just read the docs and test often on your lowest platform. Testing on the others does not hurt, but it's wrong to think that you need to write two versions or do some magic, I think everything I ever wrote has run under W98 and the NT stream, unless I used features that limited it to W2000+.
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
|
|
|
|
|
hi,
I have 1 problem and 1 doubt.
Problem.
I have to extract the text from a CEditView and parse it and fill some structure for calculation.I use the embedded control to get the text using a char array of some size.My data file format is something like this
/Comments
[tag]
123
234
345
[tag]
/comments
The problem is this.
When I read the first line,the array is filled with '/Comments.'
When I read the second line, the array is filled with
'[tag]ents'
When I read the actual data line,the array is filled with
'123mments'.
I cant parse.I cant parse even with the data ending with a semicolon.
How to solve this.Can memset,ing the array with 0's help?
Doubt:
To set multiple lines of text,is doing something like this the only way?
const char multLine[] =
"line1"
"\r\n"
"line2"
"\r\n";
GetEditCtrl().SetWindowText(multLine);
Goran Dokic
|
|
|
|
|
The way you're setting the text is right, and you have the answer, if you're iterating through and the null is not being set, set it yourself.
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
|
|
|
|
|
Okay, I know I'm horribly below all of you as far as skill level, but I'm having a very strange problem with a function not being called. It's inside a while loop, though- is that a problem?
|
|
|
|
|
A do-while function will get called once, no matter what. Otherwise, it will NEVER get called if the while statement evaluates to false.
while(false)
{
// we never get here
};
do
{
// This will run once
} while (false);
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
|
|
|
|
|
If you post the code you'll get a very quick answer.
Regards,
Brian Dela
|
|
|
|
|
What is the correct way to read and write raw data to and from an access database from c++. The field is a Ole Object in the database.
The table has two fields in it
1) type -- long
2) data -- Ole Variant
CDaoDatabase db;
CDaoRecordset recset(&db);
db.Open("data.mdb");
recset.Open(AFX_DAO_USE_DEFAULT_TYPE, "SELECT * FROM Main" ,NULL);
recset.AddNew();
recset.SetFieldValue("Type", (long)1);
BYTE* pInfo;
pInfo = new BYTE [30];
for(int i = 0; i < 30; i++)
pInfo[i] = i;
recset.Update();
recset.Close();
db.Close();
How do i get the data from pInfo into the the field "data" in the database?
this data could be anything from a bitmap to text.
thanks
|
|
|
|
|
Use void SetFieldValue( LPCTSTR lpszName, const COleVariant& varValue );
1. Put the byte array into a safearray of type VT_U1
2. Embed the array in a variant
3. Pass it to the above function
|
|
|
|
|
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..
|
|
|
|
|