|
This might/might not help for queston 2
CDocument* pDoc;
CDocTemplate* pDocT;
POSITION p;
p = AfxGetApp()->GetFirstDocTemplatePosition();
pDocT = AfxGetApp()->GetNextDocTemplate(p);
pDocT->OpenDocumentFile(NULL);
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CJulieView *pView = (CJulieView *) pChild->GetActiveView();
no bounce no play
|
|
|
|
|
Hi,
Does anybody know if there is any function in windows which returns the complete pathname of a file in a directory?
Thanks,
Deepak Samuel
|
|
|
|
|
The win32 function GetFullPathName ought to do it. It requires that the file is in your process' current directory though.
--
He is the painkiller. This is the painkiller!
|
|
|
|
|
At the command line enter Explorer /e,/select,c:
If the user selects a file can you get the return value from explorer?
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
Hi.
I have been trying to compile a library.
It compiles fine under gcc compiler.
Here is the part of original code that doesnt compile.
struct iax_frame {<br />
<br />
unsigned short callno;<br />
<br />
unsigned short dcallno;<br />
<br />
void *data;<br />
<br />
int datalen;<br />
<br />
int retries;<br />
<br />
unsigned int ts;<br />
<br />
int retrytime;<br />
<br />
int outoforder;<br />
<br />
int sentyet;<br />
<br />
int oseqno;<br />
<br />
int iseqno;<br />
<br />
int transfer;<br />
<br />
int final;<br />
<br />
int direction;<br />
<br />
int retrans;<br />
<br />
struct iax_frame *next;<br />
struct iax_frame *prev;<br />
<br />
struct ast_frame af;<br />
unsigned char unused[AST_FRIENDLY_OFFSET]; <br />
unsigned char afdata[0]; <br />
};<br />
<br />
The code where i get error is <br />
<br />
struct hell{ <br />
struct iax_frame fr2; <br />
unsigned char buffer[4096]; <br />
} buf;<br />
<br />
The error is
error C2229: struct 'hell' has an illegal zero-sized array
If you are wondering why wouldnt i just put
unsigned char afdata[4096];
then the reason is that the sizeof will give me 4096 included in it and this will make it incompatible for sending over this protocol cuz i need to send iax_frame first and the data of variable length later.
This is a library and i cannot change the code inside it.
So do you ppl have any thoughts of allocating some memory infront of iax_frame so that i get afdata[0] to be 4096 at runtime.
doing it assembly way might be difficult too.
By the way it compiles fine if i put buffer before iax_frame in hell. THe software crashes.
-----------------------------
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
I'm assuming these frames are allocated something like this:
struct iax_frame* p = malloc(sizeof(struct iax_frame) + 4096) so that it can be freed with a single
free(p); later on. Just change the size of afdata to 1, and
struct iax_fram* p = malloc(sizoef(struct iax_frame) + 4095) after modification..? It shouldn't break binary compatability.
--
He is the painkiller. This is the painkiller!
|
|
|
|
|
That's probably a gcc-specific extension (an array of 0 size is obviously illegal - how do you take its address or dereference it?).
MSVC has its own extension for a variable-sized array, which must be the last element in the struct
unsigned char afdata[]; The alternative is to make the array of size 1, which will work on all compilers (see for example the struct SHITEMID ).
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
If my rhyme was a drug, I'd sell it by the gram.
|
|
|
|
|
Hello all
I'm getting this error in my code and my stack trace is the following .
_NMSG_WRITE(10) line 221
abort() line 44 + 7 bytes
AILERONPUSH! terminate(void) + 111 bytes
AILERONPUSH! _CxxUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *) + 46 bytes
KERNEL32! 77eab45f()
KERNEL32! 77e8b2eb()
it's saying that "user breakpoint reached at xxxxx". I'm having an application in which I've one parent thread and 5 child threads. parent thread read records from database and assign them one by one to child threads for processing. I'm maintaining a queue which contains handles to child threads. Queue will be empty when all the threads are assigned a record and at this point parent thread will wait. once each thread finishes it's job it will put it's handle in queue so that parent can assign him the next record.
I'm experiencing the above error only if the no. of records to be processed are more than no. of threads( In this case threads will be used repetitively by parent thread depending upon their availablility in queue).
Can any one help me resolve this error? It'll be of great help if anyone can give me insight into situation's that cause the above error.
Thanks for your help
Hari.
|
|
|
|
|
Hi,
I just started with VS7, and wrote a programme which takes arguments, where can I give command-line arguments in Visual Studio 7.0 so that when I run the programme from VS it will automatically take them.
Thanks in advance
|
|
|
|
|
|
|
I need to print 2 pages per sheet in my application without showing any type of print dialogs. It also needs to work in Windows 98, 2000, XP. I am using a proprietary set of API's and I need to send a PRINTDLG object to this API's print function.
What this program does is print charts in some proprietary format(I have limited ability to manipulate these charts), and i want to print two charts on one sheet of paper. I can print a chart easily on a half of the page, but how would I print 2 on a sheet? I cannot combine the charts into one either.
I know that on this 98 machine, I can go to Print/Properties and select the "finishing" tab to print multiple per page. Is there a way to set this in my program? Also, is this something that Windows 98 allows me to do, or is it something that this particular print driver allows me to do?
I searched through the articles and checked out the Printing Section, but to no avail. Can anyone answer some/all of my questions?
Thanks
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
Printer driver only. Many HP printers, for example, do n-up printing like this. Anything you do is therefore printer specific.
The DEVMODE data is what's saying do two pages per sheet. If it was me, and I really HAD to do this, I'd get the default DEVMODE block, then get a block which does 2-up, and compare the two. Hopefully, dmDriverExtra would be the same value in both cases. However, you have to then dump the bytes from
the end of the DEVMODE (hint: dmSize) and examine them 'by hand'.
Hope this helps.
Steve S
|
|
|
|
|
How do I create a new FILETIME for given date and time?
<br />
int day,month,year,hour,min = 0;<br />
sscanf(pszDateTime,"%d/%d/%d %d:%d",&day,&month,&year,&hour,&min);<br />
DOSTIME time;<br />
DOSDATE date;<br />
<br />
date.day = day;<br />
date.month = month;<br />
date.year = year - 1980;<br />
<br />
time.hour = hour;<br />
time.min = min;<br />
time.sec = 0;<br />
<br />
FILETIME fTime;<br />
if(DosDateTimeToFileTime(*(WORD*)&date,*(WORD*)&time,&fTime)==0)<br />
return -1;<br />
<br />
Problem is DosDateTimeToFileTime() always fails. I want a FILETIME that I could compare with using CompareFileTime().
TIA.
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - Writing Word addins
Office addin
|
|
|
|
|
|
Mike,A big hello.
sorry I missed that part. DOSDATE and DOSTIME structs looks like:
typedef struct DOSDATE<br />
{<br />
WORD day;<br />
WORD month;<br />
WORD year;<br />
}DOSDATE;<br />
<br />
typedef struct DOSTIME<br />
{<br />
WORD hour;<br />
WORD min;<br />
WORD sec;<br />
}DOSTIME;<br />
But I cann't seem to get it right.
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - Writing Word addins
Office addin
|
|
|
|
|
Well, casting a DOSDATE to a WORD won't do you any good, since a DOSDATE is not a WORD , nor is it packed into a WORD as described in the docs for DosDateTimeToFileTime() . You'll need to pack them yourself, or do some trickery with the structs, maybe this (note: untested):
typedef struct DOSDATE
{
unsigned day : 5;
unsigned month : 4;
unsigned year : 7;
} DOSDATE;
typedef struct DOSTIME
{
unsigned hour : 5;
unsigned min : 6;
unsigned sec : 5;
} DOSTIME;
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
If my rhyme was a drug, I'd sell it by the gram.
|
|
|
|
|
I'm attempting a first for me - connecting to and using a SQL Server DB using VC++6. I've been studying the Enroll samples, and find them clear enough, but I'd like to find a step-by-step tutorial that walks me through the process using VS6. For once Google isn't being helpful, and the articles on MSDN are less than perfectly clear to someone new to DB programming. Any recommendations?
"Your village called - They're missing their idiot."
|
|
|
|
|
|
I managed to find my way around using the IDE - my first stab was to create a database project using the wizard, but that clearly doesn't do what it sounds like it should. But a second try using the MFC App Wizard seems to have done the trick; I've never asked the wizard to include database support before, and it made it amazingly easy, since I'd already created the datasource on SQL Server. What I'm trying to do is quickly gain some experience with ODBC in C++ in preparation for a hoped for interview in a few weeks, coming from a history of doing only dialog and console apps. I found out in the first interview that they're using MFC to access SQL Server and a database on a remote AS400 system, so I suspect ODBC is the best choice for me to tackle first. Having done it once on my own will help me to avoid sounding like a complete idiot if I'm selected for the final interview.
You're right about the ADO stuff here - it's been invaluable to me for web db access! We've got some really great authors on this site, but none have covered what I'm looking for right now. Perhaps I should document the steps as I go and do an article later for other tyros...
"Your village called - They're missing their idiot."
|
|
|
|
|
Roger Wright wrote:
What I'm trying to do is quickly gain some experience with ODBC in C++ in preparation for a hoped for interview in a few weeks, coming from a history of doing only dialog and console apps. I found out in the first interview that they're using MFC to access SQL Server and a database on a remote AS400 system, so I suspect ODBC is the best choice for me to tackle first.
A lot depends on the age of their code and the experience of their current developers. I haven't used MFC built in CRecordset/CDatabase stuff since about '98.
If you've used ADO with VB/ASP, then using it in C++ is pretty much the same, apart from having to do a bit more typing.
The #import "C:\Program Files\Common Files\System\ADO\msado15.dll" generates a nice ADO COM wrapper which will let you do most database calls just like you would with ASP. There are some good classes here on CP which go into further detail.
I haven't looked at the MFC classes in quiet a while, but as they are quiet old MSDN has plenty of topics on the subject.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_Database_Topics_.28.General.29.asp[^]
might be a good starting point (if you haven't already seen it)
Michael
Blue canary in the outlet by the light switch
Who watches over you
Make a little birdhouse in your soul - They Might Be Giants
|
|
|
|
|
Michael P Butler wrote:
A lot depends on the age of their code and the experience of their current developers
Considering that the IS Manager I interviewed with this week proudly displays a framed MFC Certificate on his wall, I think I'm fairly safe in assuming that MFC is the way to go for now. He also informed me that they use VS6 exclusively and have no near-term plans to move to .Net. I don't know about the experience level there, but the boss is an accountant who taught himself programming and one of the staff I met teaches at the college (VS5). I know I have a lot to learn, but it shouldn't be hard to manage; besides, it's so much easier to learn quickly when you have access to coworkers with more detailed knowledge. The code is old, but they're staffing up for a complete rewrite of the casino player management system, and I want to play!
Thanks for the link! I've been there before, but I'll be spending a lot of time with it.
"Your village called - They're missing their idiot."
|
|
|
|
|
If you really want to shine, you could always use OLE DB. Sure, it's a bit more low level than ADO, but if you're not dealing with data bound controls, then ADO doesn't really offer anything but tedious _bstr_t s and _variant_t s.
OLE DB consumers (client code) are quite easy to get going with as this article[^] shows. <plug>And if you'd like nice versions of CCommand and CDynamicAccessor, then you can always try out my stuff[^]. It probably won't compile with VC6, but I don't think it would take too long to get it to work with VC6.</plug>
But using static accessors (used in the first article I mention), you'll get perfomance ADO won't ever come close
--
He is the painkiller. This is the painkiller!
|
|
|
|
|
Hi
I am not using mfc or any kind of complex thing
I just work with windows forms using c++.
My question is how can I have a have the following.
by clicking the fist Button. user starsts a while loop. In the loop a series of events take place, and then we ask the user to input something to textBox. user enters the data and,clicks the 2nd Button. the program gets the data and goes back to the loop continueing its job.
what i have so far is :
private: System::Void 1stbtn_Click(System::Object * sender, System::EventArgs * e)
{
while (mycondition is true)
{
...do the job
wait for 2ndbtn to be pressed;
...do the job
}
}
private: System::Void 2ndbtn_Click(System::Object * sender, System::EventArgs * e)
{
lol = textBox->Text;
}
what is the sytax and what libreries should be used?
|
|
|
|
|
You're thinking sequentially, which is not how windows forms (or any windows based program) works. The wait for the 2nd and further button is done by .NET itself.
Thus, when the first button is clicked, you do some stuff inside it's handler. When the second button is clicked, you do some stuff inside it's handler and so on.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|