|
How about MSDN?
Click Technical Articals
Click Rebasing Win32 Dlls
Thank You
Bo Hunter
|
|
|
|
|
Thanx all, my intension is to know the process of loading of a dll. I dont think its going to be usefull directly while programing, but understanding its concept may be usefull in the future under unknown circumstances.
My God is more powerfull Than Your God.
|
|
|
|
|
I've been having a problem, that I can't quite figure it out. Here is the layout of the file. There is an extern unsigned char data[6 * 1024 *1024] in a header file I have. When the data is loaded into the variable, the bytes are swapped. I am trying to use the _swab function, but to no use. I've defined a variable, char rData[6 * 1024 * 1024], local to a function I have. The _swab function looks like this:
_swab((char *)data, rData, sizeof(datasize));
*datasize is the acutal number of bytes that were written to the data.
This should work, I think. But instead, the program hangs, and creates an exception that ends the program.
Any help is WIDELY appreciated. Thankx.
Chris
|
|
|
|
|
Elfuzzbo! wrote:
I've defined a variable, char rData[6 * 1024 * 1024], local to a function I have.
That will likely blow your stack.
Ummm, what exactly do you want to swap ?
Usually you swap short, long, float, double that were written in one endian format and are being read in another.
You are just talking about a massive char array. What does the char array represent ?, if it's just char then swapping is likely not what you want to do.
...cmk
Rosencrantz: I don't believe in it anyway.
Guildenstern: What
Rosencrantz: England
Guildenstern: Just a conspiracy of cartographers then.
Save the whales - collect the whole set
|
|
|
|
|
i have a couple of quick questions on MFC-based MDI apps, that hopefully you can help me out with. i'm looking over some books, but none of them have the answers. maybe they're too basic... but i can't figure out for the life of me. and there aren't that many win32 programmers around me, and ones who do don't know it either.
anyway, 3 questions:
1. from my CMainFrame (derived from CMDIFrameWnd), how do i traverse through each existing (open) CDocument? i know i can go through MDINext() to retrieve each view, and then call GetDocument() on each view. but MDINext() also activates the view, which i don't want. i want to do it in the background, send a message or call a function on the CDocument objects. how?
2. how do i make CMainFrame create a new CDocument/CView in code? i know it starts from CWndApp::OnFileNew, but what exactly do i want write in code? for instance,
CMainFrame::OnMakeNewView()
{
// what do i write in here?
}
3. how do i create a new CView on the same CDocument in code? i can goto the menu and select 'Window->New Window', and that will create a new view on my active document. but how do i do that in code?
these seem like really easy questions, but no one seems to know and i can't find any good information on them. can you help me out, or point me somewhere on the web?
ron huang
rkhuang@hotmail.com
|
|
|
|
|
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."
|
|
|
|