|
Where are/were you doing the selection delete?
I'd do it after the drop, or before the first select.
Is any of this done asynchronously? That would leave the selection object locked during the 'drop', for example. I don't have Visio on any of my machines right now, and at the risk of seeming unhelpful, I'm not about to install it to try this at home Hey, I have a life somewhere, I'm sure...
At the risk of sounding fatuous, have you tried this in VB code? It might be, for instance, that you have a lingering interface that you don't need, or something similar that VB manages. If it works there, your problem is your code, not the way it works (but you've heard me say that before...)
Steve S
|
|
|
|
|
Ah - the man himself!! Hope all is good sir!
Have managed to get it sorted now, but thanks for the advice anyway...
The history is that originally it was a VB app, but if it was run more than once under the debugger, it was crashing and taking the IDE down with it - and by run, I mean F5, do some stuff, stop the app, F5 again, try to do some stuff and BANG....
Tried various things up to and including service packs for VB, but to no avail, and since urgent, was forced to do a re-write....
In terms of what was going on with the selection, since I did a straight port from someone else's code, stuck with their algorithm..part of it was to save the imported document to temp.vsd. Unfortunately, the second time round the loop, it was not overwriting the file, so when setting the src for the control, it was using the (unchanged) same file. Got around it by using lots and lots of different files (you know me Steve - why use one file when can use dozens!)
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
That's why the C runtime includes the capability to create a uniquely named file (see mktemp). You did, I assume, have error-checking when opening the file the second (and subsequent) time, to be sure you really could write to it? (rhetorical).
Main thing is that it's sorted, and you know why. Nothing worse than a problem that wriggles away, leaving you with a nagging 'what if it comes back?' feeling...
Steve S
|
|
|
|
|
I am having trouble doing this program.
write a simple menu-driven program to allow a user to request a record by KEY. You should search (read) the file for the record, and display it if it exists in your file. A user can delete a record. If it exists, you need to add its vacated block location to the free list. A user can add a new record. if it does not exist, you will take a free block from the free list, and place the record there. Be sure to update all "next record" and "previous record" pointers on all add and delete operations. A user can update a record. if the record existsall you need to do is to allow the user to enter a new field value, then write the record back to the file. Finally, you should allow the user to display the file to screen as well as write it to a text file (not a binary file).
THe record can be a couple of fixed-length strings and an ID field, say an integer. To maintain both record blocks and empty blocks, each physcal record will have a pointer (really a file offset) to the next physical block and the previous one. In a sense this will be similar to a linked list - but it will exist in a file, not in memory.
Make data set large, at least 10,000 records. Gather data randomly or get a large data file from the internet. The exact data is up to you, but you should have int class an integer key value, plus at least two other fields. At least one of them should be a string (use a C-style string which is fixed length, to allow for easy random access binary file movement with seekg() or seekp().
|
|
|
|
|
juntupally wrote:
I am having trouble doing this program.
Ok, so exactly what part is troubling you?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I am having trouble with th eentire program, it would be great if u can run me thru the whole program. firstly I need to generate a free list using seek(). I think it would be easy if u can explaing me how to do the entire program.
|
|
|
|
|
Sounds like someone wants someone else to do their homework for them.
I don't get it why not try to do it and if you have questions then post the code in which you do have. Just my two cents worth.
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
The subject of your post includes the words "help me." Unless I'm missing something, that implies that you would be actively participating. But from reading the body of your post, it seems that you just want to assume a passive role.
juntupally wrote:
I am having trouble with th eentire program...
When you have trouble with the concept of an entire program, you need to visit your instructor. Something is not clicking during your classroom time. When you have trouble with a specific subject (e.g., linked list, short-circuit conditions, loops, callback functions), then you should seek help outside the classroom.
juntupally wrote:
...it would be great if u can run me thru the whole program.
I trust this was talked about in the classroom.
juntupally wrote:
firstly I need to generate a free list using seek().
Are you sure that seek() can be used to accomplish that? The only seek() I could find documentation for was in the context of multimedia.
juntupally wrote:
I think it would be easy if u can explaing me how to do the entire program.
I'm sure it would!
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
|
Hi,
I'm very new to ATL and need your help. I am trying to create a com dll using ATL which should contain a tabbed control and each tab page should be able to contain many other controls (or a composite control). Please let me know how I can create a control like that. Also how do I interact with individual controls in each pages (how to initialize, modify, store etc).
Please give me some pointers or, a link to page which explains it in detail.
Thanks in advance
|
|
|
|
|
As the topic suggest, I was wondering how you could go about converting a CString to a CInt?
I'm basically making a basic calculator which when a button with 5 on it is pressed will do something along the lines of
<br />
outcome += "5";<br />
and so on until the user presses the equals button.
How could I make it convert the string outcome which is storing all the operations and numbers, convert into a CInt?
Thanks
|
|
|
|
|
Considering that there is no such class as CInt, it's nigh well impossible.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Pardon me, but what is a CInt ?
At least my MFC/MSDN/ATL reference does not know any such thing. Did you mean a normal integer ?
You should draw a quick schema of how a basic calculator works. Sketch an outline of the possible states your calculator can have, and all the possible ways to move from one state to another. For example, there is a 'neutral' state, from which you can press a button to move into 'entering a number' state. Take all possible ways into account, how a person could use a calculator, what buttons he/she might press. If you have a real calculator at hand, you can easily determine the possible routes.
But, this is all about designing your software. For the actual conversion, which you asked, you need to use the LPCTSTR -operator implemented in CString class. This gives you a pointer to a constant character buffer that efficiently represents the C-language version of the string. Then, depending if you have Unicode enabled, you can use the wide- or normal-versions of _atoi and _itoa routines that can convert a string representation of a number, e.g. "42341", into a number 42341, and vice versa.
As for the calculator itself, you need several CString objects and a few integers. The first one is bound to the actual text output (an edit box), and displays a formatted string looking like a calculator's output.
Then, the user interface of your calculator has buttons. Each of these buttons has a click handler. Basically, you need to implement each click handler (or a range handler) so, that it determines what button was pressed, and adds a raw number into a background number buffer accordingly.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
CInt is a vb6 function used to convert a string to a 16 bit integer.
Use int atoi( const char *string );
|
|
|
|
|
oops, I got it wrong...No such thing as a CInt... Funny
Thanks alot for the help anyways.
|
|
|
|
|
atoi(outcome); // this would convert the string to an int.
in my programs i have used something like this for edit boxes.
CString ticket1conversion;
ticket1conversion.Format("%d",m_ticket1);//converts the int to a string
m_ticketcontrol.GetWindowText(ticket1conversion); // gets the value
// from edit box
int TicketHolder=0;
TicketHolder1 = atoi(ticket1conversion);
if (TicketHolder1==1)
{
...
}
Hope this helps. Some of the steps might not be needed but this is what works for me.
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
Ok i've converted the string to an int, but its not working as I planned..
What i've done is created a few buttons for a calculator.
Theres a string, and every time you click on a button a value is added to the end of the string. For example if you click a button with 5 on it, the code would be StringOutcome += "5".
I thought you may be able to do things like addition as well, so if you pressed 9 then + then 4, StringOutcome would be "9+4". If, in turn you converted this to an int it should see it as 9+4, therefore as 11. Only problem is that its not working like that... Its just displaying the first number you press.
Can anyone shed light on what is happening, and any kind of way around it?
|
|
|
|
|
Blue Pyre wrote:
If, in turn you converted this to an int it should see it as 9+4, therefore as 11. Only problem is that its not working like that
its not a problem, it will not work like that... Its a logic error. When the user clicks on +,-,/ or * you convert the string and store it in another variable and the operation to be performed like +,-,etc then take the second no also from the user. Now add/sub/mul/div the two no.
basically you need 2 seperate inputs and one operation input.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Just curious why are you using a string to begin with when your dealing with Integers? What I would do is this
you have your buttons number0-number9.
I would make an edit box which I assume you have done and give it a control variable of m_outvalue of type CEdit.
Also make you some variables:
bool minus; // true or false for minus button pushed
bool plus; // true or false for plus button pushed
int m_total; // integer value to hold the calculated value
Then click on the button say button 1 and it will make OnButton1();
void CCalculatorDlg::Onnumber1()
{
if (!minus && !plus)
m_total=1; // if neither the plus or the minus is pressed you add 1
if (plus)
{
m_total=m_total+1; // if plus was pressed add one to total
plus=false; // set the bool back to false
}
if (minus)
{
m_total=m_total-1; // if minus was pressed deduct one from total
minus=false; // set the bool back to false
}
CString TempString; // your temp string holder
TempString.Format("%d",m_total); // converts int to string
m_outvalue.SetWindowText(TempString); // outputs string to edit box
}
void CCalculatorDlg::Onplus()
{
plus=true; // turn the plus bool on for addition
m_outvalue.SetWindowText("+"); // display the plus sign in your edit box
}
void CCalculatorDlg::Onminus()
{
minus=true; // turn the minus bool on for subtraction
m_outvalue.SetWindowText("-"); // display the minus sign in your edit box
}
void CCalculatorDlg::Onnumber2()
{
if(!minus && !plus)
m_total=2; // if the minus or plus is not pressed make total 2
if (plus)
{
m_total=m_total+2; // if plus was pressed add two to the value
plus=false; // set plus bool to false
}
if (minus)
{
m_total=m_total-2; // if minus was pressed deduct two from value
minus=false; // set the minus bool to false
}
CString TempString; // temp string holder
TempString.Format("%d",m_total); // convert int to a string
m_outvalue.SetWindowText(TempString); // display string in edit box
}
void CCalculatorDlg::Onequals()
{
CString TempString; // temp holder for string
TempString.Format("%d",m_total); // convert int to a string
m_outvalue.SetWindowText(TempString); // display string in edit box
}
I hope this helps you.
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
I have a question...
Im trying to develop a application but there one thing thats confusing me
How do you develop a application that uses windows forms in C++ .NET that will shutdown you computer?
|
|
|
|
|
See this[^] article, from the relevant parts. Refer to the source code for an example how to shut down a Windows OS.
If you are allowed to call unmanaged functions, use ExitWindowsEx in the Platform API. This will shut down Windows.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi ppl.
I have this c++ class and i want to make it available to my vb app.
I need a good COM tutorial. (Net is full of CRAP).
All methods in my class are static.
Thx.
|
|
|
|
|
How can I get the dimension of the secondary display in windows xp?
GetSystemMetrics(SM_CXSCREEN) and GetSystemMetrics(SM_CYSCREEN) give me the primary screen dimension, but there is no way I can get the secondary display with GetSystemMetrics.
I can get all the virtual display dimension with SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN parameters, but this do not solve my problem.
Any tips?
Regards
Bernardo Faria
|
|
|
|
|
Hi
What is correct procedure for sending F5 key or left arrow key?
SendMesage(hwnd,WM_CHAR,?,?) or SendMesage(hwnd,WM_KEYDOWN,?,?)
Tomaz Rotovnik
|
|
|
|
|
Tomaz Rotovnik wrote:
What is correct procedure for sending F5 key or left arrow key?
None of these actually. Use keybd_event WIN32 API function instead. And if you are using Windows 98 or later, use SendInput for this purpose.
Gurmeet S. Kochar
If you believe in God, it's because of the Devil
|
|
|
|
|