15,885,244 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by mr.abzadeh (Top 173 by date)
mr.abzadeh
21-Feb-16 9:47am
View
@Richard MacCutchan: I knew that. The question is: Why SQLGetData doesn't return the total sizeof data in bytes? so that programmer allocate a buffer and read data, without using tedious loops? It is very simple to return data size in StrLen_or_IndPtr, and previous versions of sql server/odbc driver ded this.
mr.abzadeh
21-Feb-16 5:11am
View
SQLGetData requires BufferLength in bytes
mr.abzadeh
4-Dec-15 10:49am
View
It's a good idea. I'll add this as an option to my clients. But I think this is useful in smaller networks because the time cost of creating a thread in server for each transaction is too much.
mr.abzadeh
4-Dec-15 10:46am
View
It's a good idea. I'll add this as an option to my clients. But I think this is useful is smaller networks because the time cost of creating a thread in server for each transaction is too much.
mr.abzadeh
4-Dec-15 10:42am
View
Deleted
The Idea of pinging is very good. I added the option "ping before send" to my client application to analyze and log any disconnection. Also I'll create a simple ping utility that executes command line "Ping -t" and capture console output and store to file. Please notice that The problem occurs in few local area networks. There are networks with 100 users of my client program that this problem never occurs.
mr.abzadeh
3-Dec-15 1:31am
View
Thanks for your guide. I didn't know that. The problem occurs for all clients randomly. I agree that the problem is outside my server-application. But how can I identify that? Is there a reliable socket monitor that monitors the closing sockets and the source and reason of closing, such as a hardware action or a process that does this?
mr.abzadeh
3-Dec-15 1:24am
View
Yes. clients keep the connection until user decides to exit, or a SOCKET_ERROR is received.
mr.abzadeh
30-Nov-15 8:44am
View
No, delays are less than 1 second.
mr.abzadeh
30-Nov-15 6:01am
View
E.F.Nijboer: Please read the question and then offer solution. The links you offer is about creating services. My service is ready and fully functional. My question is to distinguish between running as a service or application at run time.
good hopes
mr.abzadeh
11-Oct-15 15:47pm
View
This link is about services and has no Information about my question
mr.abzadeh
8-Oct-15 9:37am
View
The link you provided refers to .Net applications. My application is Win32, The tag was incorrect, So I corrected it.
mr.abzadeh
8-Oct-15 9:33am
View
Deleted
The link you provided refers to .Net applications. My application is Win32, As I tagged C, Windows.
mr.abzadeh
6-Sep-15 19:20pm
View
Thanks a lot. Very helpfull link.
mr.abzadeh
5-Sep-15 13:02pm
View
Very good explanation. Extension to 32 bit is compiler specific, or not garanteed. Thanks
mr.abzadeh
3-Sep-15 12:59pm
View
I edited the question, adding disassembly of a simple code. It shows that 8 bit and 16 bit values are converted to 32 bit values, then pushed to stack (or 4 registers)
mr.abzadeh
2-Sep-15 14:17pm
View
I meant padding. smaller types when passed to vararg functions, they are padded to 32 bit values. This doesn't occur in non-vararg functions
mr.abzadeh
19-Aug-15 18:14pm
View
It's a good idea. Some code in form.Show will be changed because of syncronization between mainform and form.
mr.abzadeh
19-Aug-15 18:12pm
View
In some situations it is needed. Surely windows forms has a way to call form.ShowDialog() straightly. One way is to have a command1 in menu to click to call Showform.Dialog(), If it's possible to mainform to request the menu to click command1, some thing link win32 PostMessage.
But I'm not familiar enough to do this in .net
mr.abzadeh
19-Aug-15 7:32am
View
Yes, I wasn't exact. It's event handler. By calling form2.ShowDialog() The only problem is that the main window have some shakes when form2 is closed.
And it seems bad programming to postpone the handling the Shown event and the events after it. I'm new to windows forms, and I don't know if it's a bad idea to show a modal dialog after a form is created? If so, what is the alternative?
mr.abzadeh
19-Aug-15 1:57am
View
I want to show the dialog only at startup. The dialog is modal, needs user attention. no splash window.
mr.abzadeh
19-Aug-15 1:54am
View
blocked because the added Shown event doesn't return until form2 is closed. I wanna use another thread. I spoke of thread because of my background of Win32 API programming. and as I mentioned, I'm new to .NET and windows forms. My question is this: At which point should I call form2.ShowDialog()? without causing the main form events suspend?
mr.abzadeh
19-Aug-15 1:45am
View
My code is exactly as above. By blocking I mean that the Shown event I have added to main form returns after foorm2.ShowDialog() returns, and calling some main form events is called then, which is not a proper way. One effect of this design is the main form flickers after form2 is closed.
mr.abzadeh
5-Jul-15 6:42am
View
dumpbin /disasm produces an assembly listing exactly matching that of C disassembly, different from disassembly of Delphi.
mr.abzadeh
4-Jul-15 19:44pm
View
Deleted
dempbin /disasm produces an assembly listing different than sisassembly of C and delphi. for example, xor eax, eax in disassembly is replaced by xor ecx, ecx. It seems /disasm decides to use registers it wants, not registers in the DLL image. I'm very confused.
mr.abzadeh
4-Jul-15 19:02pm
View
I copy and pasted C disassembly, and I type the delphi disassembly because delphi 7 disassembler didn't allow copy. I didn't modify anything. I searched for the binary code in the image itself. It matches the C disassembly and differs from the delphi disassembly. I have com to a point that the DLL modifies
it's code when loading from delphi, may occur on dllMain, possibly to protect itself. I will try dumbin /disasm also.
Thanks for helping me.
mr.abzadeh
4-Jul-15 18:29pm
View
Deleted
I search for the binary code in the image itself. It matches the C disassembly and differs from the delphi disassembly. I have com to a point that the DLL modifies it's code when loading from delphi, may occur on dllMain, possibly to protect itself.
mr.abzadeh
4-Jul-15 17:36pm
View
I tried to bypass DLL function's exception handling by skipping
mov dword ptr fs:[eax],esp
No success. It seems that the DLL function uses try/catch in many inner functions
mr.abzadeh
4-Jul-15 17:26pm
View
No, only one function. dumpbin.exe /exports only one function with this name. but they are different when called from C and delphi. why? It's not a bug of disassembly because eip changes appropriately.
The information you provided about exception handling I understand that the DLL functions uses it's own try/catch. This is the reason that the exception is not cached by host functions try/catch. I will try to bypass DLL function's try/catch to see if I can catch the exception
mr.abzadeh
4-Jul-15 15:41pm
View
First chance exception. And the thread is terminated. That's what debug window's saying, not me. I'm passing ansi char, delphi passes ansi char, and the routine expects ansi char, I debuged the routine to a point in C and delphi. Both were stdcall. parametes passed right to left, stack cleaned by called routine. Strange is that disassembly window in Delphi and visual studio are different. Please see my Edit on main post
mr.abzadeh
3-Jul-15 15:23pm
View
Never reaches the return point. wrong parameters is not a candidate because a test delphi app calling with exactly the same parameters succeds.
Now I have 2 cases:
1: Missing delphi runtime. if so, calling a function from a delphi dll from c will be feaseless
2: Internal structure of pAnsiChar maybe not compatible to char *.
mr.abzadeh
3-Jul-15 13:40pm
View
I shouldn't say 'Yes' above. the function is __stdcall. It's return instruction is ret 8. but the problem is that It hangs, debug window shows a first chance exception, and thread terminates. but 20% of cpu is taken by my app(how is cpu taken, once thread terminated?), and never returns.
The equivalent code in Delphi works. It returns and never hangs.
the delphi code is as this:
{declaration}
function DCL_Initialize(bDeviceID: Byte; sIP: PAnsiChar): Byte; stdcall external 'DCL.dll';
{usage}
procedure TForm1.Button1Click(Sender: TObject);
begin
{Edit1 and Edit2 are TEdit controls}
DCL_Initialize(StrToInt(Edit1.Text), PAnsiChar(Edit2.Text));
end;
mr.abzadeh
3-Jul-15 4:34am
View
Yes, since pfnInitialize is a pointer fo function, The compiler calls it in this way:
move eax, dword ptr pfnInitialize
call eax
mr.abzadeh
2-Jul-15 13:04pm
View
The DCL.lib is compiled and linked with borland delphi, and no __imp_... functions exist in it. There isn't any decorative problem, because I Get the address of function. dumpbin.exe with option /exports shows exactly the same name, no decoratation exists in DCL.dll. It is interesting that the function name is case sensitive. I think The only problem is compatibility of char * and PAnsiChar. Sorrily, I don't have a delphi or pascal compiler to test this problem on depth. Thanks a lot
mr.abzadeh
2-Jul-15 10:03am
View
DCLINITIALIZE is a typedef, not function name
mr.abzadeh
2-Jul-15 9:03am
View
The pascal prototype shows stdcall. The function name is DCL_Initialize and It exists because GetProcessAddress finds it. The removal of underscore is by mistake.
I debug the assembly instructions until I reach the instruction 'call eax' ehich does not return. so this can not be because of calling convention.
mr.abzadeh
2-Jul-15 8:55am
View
I don't want to use pascal calling convention. I want to use a function in a dll whoes pascal prototype is known. source code not available
mr.abzadeh
2-Jul-15 8:51am
View
That didn't work. The error is:
error LNK2019: unresolved external symbol "__declspec(dllimport) char __stdcall DCL_Initialize(char,char *)"
The function name in uppercase also didn't work. dumpbin.exe /exports shows the function name not capitalized. I'm not sure the DCL.DLL is written in pascal, The only thing I know is it's pascal prototype
function DCL_Initialize(bDeviceID: Byte; sIP: PAnsiChar): Byte; stdcall external 'DCL.dll';
is used in a delphi application and it works correctly.
I think using #pragma comment will not work here because the DCL.dll doesn't export function __imp_DCL_Initialize
mr.abzadeh
6-Mar-15 16:09pm
View
I am creating an application to display information about a database, including table names, columns and indexes on every table.
mr.abzadeh
2-Mar-15 9:43am
View
Thanks a lot. I had studied the link once again, and I didn't find any other idea.
I think this doesn't work in Windows XP
mr.abzadeh
7-Apr-14 8:42am
View
No question. I'll use WSACreateEvent for that. Will you please post this as a answer so I can accept your answer and close the question? This question is open and I do not know to close the question.
mr.abzadeh
7-Apr-14 8:34am
View
Thanks for your good help. I agree this is a multithreading problem. I redesigned my synchronization points completely, and removed some extra threads. Now my service program works smoothly, no crashing. The only question arising from your reply is this: If the socket to be managed is in blocking mode(recv called), How can we tell the thread to close the socket and terminate without accessing socket from the manager thread?
mr.abzadeh
27-Feb-14 16:03pm
View
Thanks, Thats right. now Every thing is OK. I changed my plan. I create a udp socket and reuse it, no call to closesocket is issued. This way messages arrive clients better than before. At my earlier plan, I created udp socket, called sendto, and then called sendsocket. The first message didnt arrive to clients. subsequent messages arrived 'naturally.
mr.abzadeh
26-Feb-14 18:26pm
View
Thanks for your help. I assume it is the UDP not deliver message. I close this Post, But I have one more question: If the peer that will receive the message has been shut down without notifying, for example, due to power failure, will sendto block the thread? If so, How to overcome this?
mr.abzadeh
26-Feb-14 0:36am
View
Yes, It arrives. and even when I closesocket, 80% of times the message is delived. I don't know the resson of 20% fail is UDP fail or race condition where I close socket.
mr.abzadeh
24-Feb-14 19:20pm
View
I have fuuly checked the return values in my code. Here I simplified the code for breafness.
I studied the links above, all are the principal materials about TCP and UDP
mr.abzadeh
24-Feb-14 2:21am
View
I use TCP for communication between server and clients, starting at clients, responced by server. Sometimes conversations are started by server. Since I don't want to use two distinct ports, I decided to use UDP for messaging. the Admin at a client posts a message to server by TCP, which is mirrored to some or all of clients via UDP. it may or may not be tolerable if udp doesn't deliver message. Can you show me another plan to send messages to clients, originated at server? Since my question was very badly stated, I clarified and edited it.
My current question is this: In the following code, closesocket destroys socket very soon and prevents message delivery.
SOCKET socket1 = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
ADDRINFOW * pAddr;
ADDRINFOW hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET;
hints.ai_protocol = IPPROTO_UDP;
hints.ai_socktype = SOCK_DGRAM;
GetAddrInfoW( wszHostName, lpPortName, &hints, &pAddr);
sendto( socket1, (const char *)pBuf, uSendLen, 0, pAddr->ai_addr, Addr->ai_addrlen);
closesocket(socket1);//This kills socket and prevents message delivery
mr.abzadeh
24-Feb-14 2:18am
View
I have read up on TCP and lesser on UDP. any link describing and help implementing UDP is appreciated. My current question is this: In the following code, closesocket destroys secket very soon and prevents message delivery.
SOCKET socket1 = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
ADDRINFOW * pAddr;
ADDRINFOW hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET;
hints.ai_protocol = IPPROTO_UDP;
hints.ai_socktype = SOCK_DGRAM;
GetAddrInfoW( wszHostName, lpPortName, &hints, &pAddr);
sendto( socket1, (const char *)pBuf, uSendLen, 0, pAddr->ai_addr, Addr->ai_addrlen);
closesocket(socket1);//This kills socket and prevents message delivery
mr.abzadeh
23-Feb-14 14:07pm
View
I use TCP for communication between server and clients, starting at clients, responced by server. Sometimes conversations started by server. Since I don't want to use two distinct ports, I decided to use UDP for messaging. the Admin at a client posts a message to server by tcp, which is mirrored to some or all of clients via udp. it may or may not be tolerable if udp doesn't deliver message. Can you show me another plan to send messages to clients, originated at server? Since my question was very badly stated, I clarified and edited it.
mr.abzadeh
20-Feb-14 2:24am
View
Thanks, very usefull. I implemented my own keep-alive by calling my GetVersion in client side, and every thing is ok
mr.abzadeh
19-Feb-14 22:43pm
View
My question simply is this:
Should I set keep-alive option in Client socket, Server socket, or Both?
I dont use .Net and I can set timeout in Windows API, But It is steel unclear for me wether I should set TCP timeout in Server side or client side?
mr.abzadeh
10-Feb-14 2:53am
View
Thanks. It works,
mr.abzadeh
9-Feb-14 1:31am
View
I don't wish to close socket, The socket will close only if client closes it. From your comment, I noticed that this code is possible, but may not be efficient. Am I right?
thread A:
int iResult;
u_long iMode = 0;
iResult = ioctlsocket(m_socket, FIONBIO, &iMode);
while (1)
{
int iRet = recv(m_socket);
if (iRet == 0) donothing();
if (iRet == SOCKET_ERROR) break;
//process returned data here
Sleep(1);
}
Thread B:
closesocket(m_socket);
mr.abzadeh
9-Feb-14 1:22am
View
Suppose thread A has called recv(s1), where s1 is a blocking socket. You mean I call closesocket(s1) from thread B, Then break loop on thread A when 0 bytes recieved? I have already done this, and it doesn't work.
a sample code is here:
Thread A:
while(1)
{
int iRet = recv(s1, ...);
if (iRet == 0 || iRet == SOCKET_ERROR) break;
//process returned data here
}
Thread B:
closesocket(s1);
mr.abzadeh
9-Feb-14 1:21am
View
Deleted
Suppose thread A has called recv(s1), where s1 is a blocking socket. You mean I call closesocket(s1) from thread B, Then break loop on thread A whene 0 bytes recieved? I have already done this, and it doesn't work.
a sample code is here:
Thread A:
while(1)
{
int iRet = recv(s1, ...);
if (iRet == 0 == iRet == SOCKET_ERROR) break;
//process returned data here
}
Thread B:
closesocket(s1);
mr.abzadeh
9-Feb-14 1:18am
View
Deleted
Suppose thread A has called recv(s1), where s1 is a blocking socket. You mean I call closesocket(s1) from thread B, Then the recv will return with 0 bytes, and the loop on thread a should break if 0 bytes recieved? I have already done this, and it doesn't work.
a sample code is here:
Thread A:
while(1)
{
int iRet = recv(s1, ...);
if (iRet == 0 == iRet == SOCKET_ERROR) break;
//process returned data here
}
mr.abzadeh
4-Feb-14 12:07pm
View
Thanks. The links you showed me is great and very helpfull and now I can estimate my services stack usage. I create threads with 64 KB of stack size. I do not use thread pooling because any connection to the service I provide remains active for some hours. Now I think it's time to create a few number of threads, say 16, and The main thread only accept sockets and pass it to worker threads, Mentioning again, My problem is how the main thread will pass control to worker threads immediately.
mr.abzadeh
mr.abzadeh
4-Feb-14 2:15am
View
I provide a service. I create a thread for each connection. Currently my clients may be up to 200, so my service may have up to 200 threads. Sharing threads may increase performance but I don't know how to wake a thread when new packet arrives. Any suggestion appreciated
mr.abzadeh
mr.abzadeh
2-Feb-14 21:03pm
View
These link are very good for measuring purposes, but they are in .net I need to measure stack usage in native C/C++
Thanks for your help
mr.abzadeh
mr.abzadeh
2-Feb-14 20:53pm
View
This measures stack usage from begining to current position, not overall stack usage. I can not guess which function will be called more deeply, and windows api system calls may use stack, which Is not measured in this way
mr.abzadeh
mr.abzadeh
2-Feb-14 20:49pm
View
My program does not run out of stack. I want to measure my threads stack user so that create threads with smaller stack size, using memory efficiently
mr.abzadeh
mr.abzadeh
29-Jan-14 13:27pm
View
Thanks for your comment.
The link you pointed detects idleness of system resources such as cpu, gpu, and does not help measuring stack usage measurement.
It is not clear for me what you meant by 'code language'
mr.abzadeh
29-Jan-14 12:52pm
View
Deleted
Thanks for your comment.
The link you pointed deletces idleness if system resources such as cpu, gpu, and does not help measuring stack usage measurement.
It is not clear for me what you meant by 'code language'
mr.abzadeh
15-Nov-13 14:47pm
View
And thanks for your help. Maybe port 465 is closed width the filtering system of the country I live in.
mr.abzadeh
15-Nov-13 14:42pm
View
port 587 works. what is the problem with port 465?
mr.abzadeh
15-Nov-13 14:28pm
View
and port 587 worked with Enablessl = true; what is the matter with port 465?
mr.abzadeh
15-Nov-13 14:19pm
View
Port 25 with Enablessl = false worked, but port 465 didn't work. I examined both Enablessl = true, false, my filewall off
mr.abzadeh
1-Oct-13 12:45pm
View
Thanks. Your right
Only in the sample code ai_addr has been casted to (sockaddr_in *);
mr.abzadeh
11-Sep-13 14:44pm
View
Microsoft accepts posts and bug reports only with telephone, and my english speaking is not good, Thank you again. I accept the solution
mr.abzadeh
11-Sep-13 7:58am
View
By Visual studio with tag C, I meant Visual studio C library(MSVCRT and include files). I think a parametrized version of SetAbortProc is a need and I hope Microsoft will implement it in a near future version. I think the solution is to SAVE parametes in a static array and use hDC parameter of AbortProc to access it. Thanks for your reply.
mr.abzadeh
mr.abzadeh
17-Aug-13 19:39pm
View
Great. by SetLocaleInfo we can control number formating in a specific locale. but one thing remains: Because this function modifies values for all applications, it should only be called by the regional and language options functionality of Control Panel, or a similar utility. I want to modify values only to my application, and not to all applications.
mr.abzaeh
mr.abzadeh
12-Aug-13 7:22am
View
How to display everything in neutral culture in C? Can you please offer me a link or material to study?
mr.abzadeh
11-Aug-13 22:36pm
View
I use only unicode, especially, numerals 0x30 thru 0x39. I have nothing to do with code points. what I need is this:
The edit control display '0123456789' when it's text buffer contains L"0123456789"
I want only to disable displaying numbers in national digit shapes in edit controls.
mr.abzadeh
11-Aug-13 22:26pm
View
It was a different matter with ExtTextOut function. I wanted to display european digit shapes when I call ExtTextOut with passing ETO_NUMERICSLATIN to it, witch worked correctly. Now I am able to display European digit shapes in any device context hDC. My goal is to display European digit shapes in every window on my application. This will not be complete If I can not display european digit shapes in edit controls. edit controls paint their window internally, not giving me a chance to modify their digit shapes.
In this case, I need help to find a way displaying european digit shapes in edit controls. I do not have any problem with some function or code
Thanks for your nice helps and guides
mr.abzadeh
mr.abzadeh
11-Aug-13 15:26pm
View
No, Please not that the problem is with digit shapes, and not code points. please refer to the comments I put to Sergey's Solution. You were right with creating fonts that displays 0x660 thru 0x669 and 0x6F0 thru 0x6F9 as european digit shapes ('0' thru '9')
mr.abzadeh
11-Aug-13 15:21pm
View
I forgot to emphasis that system may change digit shapes. If we set system locale to arabic, and in the Additional settings set the native digits to national, then the edit control displays L"0123456789" as L"۰۱۲۳۴۵۶۷۸۹", and so does TextOut( hDC, left, top, L"0123456789", 10 ); this behavior can be changed by NADS(0X206E) and NODS(0x206F), or by passing ETO_NUMERICSLATIN to ExtTextOut function, but for edit controls, this does not work
mr.abzadeh
11-Aug-13 15:08pm
View
I think you have not noticed my question exactly. my problem is digit shapes, not digits, and neither code points.
for example, if in regional and language setting we set system locale to arabic, and one
calles this code:
SetTextW( hwndControl, WM_SETTEXT, 0, L"01234567890" );
the control translates unicode chars 0x30 thru 0x39 to unicode chars 0x6F0 thru 0x6F9 and displays "۰۱۲۳۴۵۶۷۸۹" which are arabic DIGIT SHAPES. Of course if this code is executed:
wchar_t wszBuffer[11];
SendMessageW( hWnd, WM_GETTEXT, 11, (LPARAM)wszBuffer );
then the contents of wszBuffer will be the original unicode chars 0x30 thru 0x39.
I want to find a way to disable this behaviour in my application, and display european digit SHAPES, independently of regional and language setting.
mr.abzadeh
11-Aug-13 13:50pm
View
It's a solution, but I do not want to restrict my application to use an special font. I want the users of my application to select thru the installed fonts freely.
mr.abzadeh
11-Aug-13 13:47pm
View
In Windows 7 -> regional and language setting -> Change system locale most people in my country set system locale to arabic. This causes digits 0x0030 thru 0x0039 print as national(arabic) digit shapes, rather than european(nominal) digit shapes. that is, unicode chars 0x0660 to 0x0669 or 0x06F0 thru 0x06F9 are shown. I want the edit control to display nominal digit shapes, independent of regional and language settings.
mr.abzadeh
28-Jul-13 10:41am
View
Sorry!! I searched google with keywords how to include library in c and how to embed library in c and I got no usefull links. I looked at #pragma directive list, but I skipped the
#pragma comment because the keyword comment was not suggestive in this case. the meaning of comment has not enough relation to linking libraries. Thanks your Help, and humor
mr.abzadeh
mr.abzadeh
22-May-13 14:06pm
View
I found that the problem was with my Windows and XPS printer, may be damaged. By Installing original Windows 7 on my laptop, Every thing worked properly, Sorry for the question.
mr.abzadeh
mr.abzadeh
22-May-13 7:53am
View
I Tested this two codes
//first example
wchar_t wszBufer[] = "?1234567890";
wszBuffer[0] = 0x206F;//NODS
int done = TextOutW( hDC, x, y, wszBufer, 11 );
//second example
int done = ExtTextOutW( hDC, x, y, ETO_NUMERICSLATIN, NULL, L"1234567890", 10, NULL );
in both examples, I expect to get "1234567890" on paper, but I get "١٢٣٤٥٦٧٨٩٠". Calling ExtTextOut makes no difference because my project is unicode and ExtTextOut translates to ExtTextOutW. I do not know what is the problem. May be my understanding of unicode NODS or ETO_NUMERICSLATIN is incorrect, as english is not my first language. Can you please check if my understanding is correct? that is: NODS and ETO_NUMERICSLATIN should print nominal digit shapes even in non european locale?
thanks sergey
mr.abzadeh
mr.abzadeh
22-May-13 7:50am
View
Deleted
I Tested this two codes
//first example
wchar_t wszBufer[] = "?1234567890";
wszBuffer[0] = 0x206F;//NODS
int done = TextOutW( hDC, x, y, wszBufer, 11 );
//second example
int done = ExtTextOutW( hDC, x, y, ETO_NUMERICSLATIN, NULL, L"1234567890", 10, NULL );
in both examples, I expect to get "1234567890" on paper, but I get "١٢٣٤٥٦٧٨٩٠".
Calling ExtTextOut makes no difference because my project is unicode and ExtTextOut translates to ExtTextOutW.
I do not know what is the problem. May be my understanding of unicode NODS or ETO_NUMERICSLATIN is incorrect, as english is not my first language. Can you please check if my understanding is correct? that is: NODS and ETO_NUMERICSLATIN should print nominal digit shapes even in non european locale?
thanks sergey
mr.abzadeh
mr.abzadeh
21-May-13 23:44pm
View
Thanks for your reply. The links you showed me is about unicode specifications and code points. I have no problem with unicode and code points, My problem is this: Windows translates digits '0123456789' (MSDN calls them european digits) to "٠١٢٣٤٥٦٧٨٩" (MSDN calls them Indu-Arabic digits, U+0660 thru U+0669 0r U+06F0 thru U+06F9) and on paper I get Indu-Arabic digit shapes. Acording to MSDN, Pinting NODS (U+206F) before printing european digits should bypass this translation and print European digit shapes (U+30 thru U+39), which does not. and the following code should print European digit shapes, which does not.
int done = ExtTextOutW( hDC, x, y, ETO_NUMERICSLATIN, NULL, L"1234567890", 10, NULL );
As you see, I use unicode libraries and pass european digits, but get indu-arabic shapes on paper. I want to get nominal digit shapes(U+30 to U+39) on paper. The links have no information about unicode libraries and bypassing translation of nominal digits to national digit shapes. My problem is still remaining.
mr.abzadeh
21-May-13 23:37pm
View
Deleted
Thanks for your reply. The links you showed me is unicode specifications and code points. I have no problem with unicode and code points, My problem is this: Windows translates digits '0123456789' (MSDN calls them european digits) to "٠١٢٣٤٥٦٧٨٩" (MSDN calls them Indu-Arabic digits, 0x660 thru 0x669 0r 0x6F0 thru 0x6F9) and on paper we sea Indu-Arabic digit shapes. My problem is this: Printing NODS (0x206F) before printing european digits should bypass this translation and print European digit shapes (U+30 thru U+39), which does not. and the following code should and print European digit shapes, which does not.
int done = ExtTextOutW( hDC, x, y, ETO_NUMERICSLATIN, NULL, L"1234567890", 10, NULL );
As you see, I use unicode libraries and pass european digits, but get indu-arabic shapes on paper. I want to get nominal digit shapes(U+30 to U+29) on paper. The links have no information about unicode libraries and bypassing translation of nominal digits to national digit shapes. My problem is still remaining.
mr.abzadeh
16-Apr-13 6:59am
View
Almost all programmers use va_start to set arg_ptr to the first optional argument, but va_start is a macro, and nobody nowhere has restricted it's use to point to another parameter other than the first. My code has 10 parameters, following by ..., and The 10th parameter was there for clarity and readablity. I used va_start to point to 9th parameter
mr.abzadeh
16-Apr-13 6:32am
View
Matthew has posted a more exact comment, (project settings, ...) but I have not changed anything in my 10 applications projects, and the I my code was compiled correctly until a weak ago. what may have been happened?
I will try to find the code that va_start is expanded to in this case
mr.abzadeh
16-Apr-13 6:26am
View
This hapens in release mode, optimizations on, visual studio SP1.
I had a code similar to this in my application, and It worked correctly until the last weak.
But now it does not. I think my visual studio SP1 optimization has been updated thru Internet, and the problem occured
mr.abzadeh
26-Jan-13 5:54am
View
Thanks for your help. I got the answer of my questions
mr.abzadeh
26-Jan-13 4:55am
View
If no simple and portable way exists to control Z order of the window created by ICDBurn::Burn (or similar functions whose code is not accessible), This may be treated as a problem with microsoft windows, which must be resolved.
mr.abzadeh
mr.abzadeh
26-Jan-13 4:45am
View
Yes, It's clear. By using threads, every thing works well, except the following:
I do not know the window handle for Window B created by ICDBurn::Burn( hWndA );
So, I can not bring it to foreground, So I can do nothing in Z order.
However, I am able to find hWndB by calling this code:
HWND hWndB = FindWindowW( L"Burn to disc" );
but this code may not be portable as the window title may change in different versions of operating system.
It's evident that microsoft knew that window B shoud come to top of Z order, and parameter hWnd of ICDBurn::Burn( HWND hWnd ) is there so that the caller can specify the parent window of the window ICDBurn::Burn creates.
mr.abzadeh
26-Jan-13 1:08am
View
Ok, It's good idea, but It may not help passing parameter hWnd in case lengthy calculations, at least in this case:
I have Window A, that wants to call this code:
ICDBurn::Burn( hWndA );
ICDBurn::Burn creates It's own Window, Say Window B, and sets Its parent window to hWndA, and Burns data to CD(lengthy calculation).
If I call ICDBurn::Burn( hWndA ) from a non-window thread, It works, But Window B will appear behind Window A, and my application's users will not notice It, and I can not post any message to hWndB because I do not have It's code. The only way is calling ICDBurn::Burn( hWndA ) from window A, or possibly another window, but this freezes the calling window and even controls on It. for example, the progress controls on Window A freeze. So, I think It's necessary to have a way to call UI functions that take long time, from a window thread, without freezing the calling window.
Can you please show me an Idea?
mr.abzadeh
24-Jan-13 18:24pm
View
For example, I created a new thread to burn data to cd, calling ICDBurn::Burn( hWnd ), buf the ICDBurn::Burn method appeared under my window, meaning that I should not pass hWnd to ICDBurn::Burn, because the calling thread had no window. How I should tell ICDBurn::Burn that hWnd will be it's Parent Window?
mr.abzadeh
24-Jan-13 18:12pm
View
Thanks, threading Ok, but for passing results to UI, I need some help in windows API because I program in native C.
Is calling the following function a good idea, somewhere in my lengthy calculation periodically?
//-------------------------------------------------------------
void uDoEvents( HWND hWnd )
{
MSG uMsg;
while ( PeekMessageW( &uMsg, hWnd, 0, 0, PM_NOREMOVE ) )
{
int bRet = GetMessageW( &uMsg, hWnd, 0, 0 );
if ( bRet == 0 ) break;
if ( bRet == -1 ) break;
TranslateMessage( &uMsg );
DispatchMessage( &uMsg );
}
}
mr.abzadeh
22-Jan-13 14:16pm
View
No, It reported that CD DRIVE is recordable for both CD-ROW and CD-RW drives, which is not correct.
mr.abzadeh
22-Jan-13 10:43am
View
I tested ICDBurn Interface, and It worked correctly, Thanks for your help.
If one day you found a way to detect recordable cd drives directly, without ICDBurn or IMAPI, please send it to me. Thanks again
mr.abzadeh
mr.abzadeh
22-Jan-13 10:31am
View
I examined it for both CD-ROW and CD-RW, with CD mounted, and the value of MediaCharacteristics in the second item of array was MEDIA_READ_WRITE,
i.e. pMediaType->MediaInfo[1].DeviceSpecific.DiskInfo.MediaCharacteristics was 8. my code is as this:
/*-------------------------------------*/
static int uIsMediaWritable( const GET_MEDIA_TYPES * pMediaType )
{
unsigned uCount = pMediaType->MediaInfoCount;
for ( unsigned uIndex = 0 ; uIndex < uCount ; uIndex ++ )
{
DWORD dwMediaCharacteristics = pMediaType->MediaInfo[uIndex].DeviceSpecific.DiskInfo.MediaCharacteristics;
if ( dwMediaCharacteristics & MEDIA_READ_WRITE ) return TRUE;
if ( dwMediaCharacteristics & MEDIA_WRITE_ONCE ) return TRUE;
//if ( dwMediaCharacteristics & MEDIA_WRITE_PROTECTED ) return TRUE;
}
return FALSE;
}
mr.abzadeh
22-Jan-13 10:27am
View
Deleted
/*-------------------------------------*/
static_func int uIsMediaWritable( const GET_MEDIA_TYPES * pMediaType )
{
unsigned uCount = pMediaType->MediaInfoCount;
for ( unsigned uIndex = 0 ; uIndex < uCount ; uIndex ++ )
{
DWORD dwMediaCharacteristics = pMediaType->MediaInfo[uIndex].DeviceSpecific.DiskInfo.MediaCharacteristics;
if ( dwMediaCharacteristics & MEDIA_READ_WRITE ) return TRUE;
if ( dwMediaCharacteristics & MEDIA_WRITE_ONCE ) return TRUE;
//if ( dwMediaCharacteristics & MEDIA_WRITE_PROTECTED ) return TRUE;
}
return FALSE;
}
mr.abzadeh
22-Jan-13 10:19am
View
Yes, there was a CD in the drive for both CD-ROM and CD-RW.
mr.abzadeh
22-Dec-12 16:14pm
View
As I understood, /RTCu and /RTCs generate extra code to capture bugs such as using uninitialized variables, detection of buffer underrun and overrund, and so on. What I need is to remove guard bytes only in a few functions (not module) in debug mode, and I Think the only solution is
declaring these few functions as __declspec(naked), which removes guard bytes completely, but need some low level programming, as creating and removing stack frame( allocating and destroying local variables ) is left to the programmer.
mr.abzadeh
21-Dec-12 18:16pm
View
/GS- does not remove guard bytes.
__declspec( naked ) does remove guard bytes, and It is a solution. but the epilog and prolog code for creating and removing stack frame will be left to programmer.
mr.abzadeh
21-Dec-12 18:09pm
View
I examined check_stack pragma, and it does not affect guard bytes
mr.abzadeh
19-Dec-12 6:24am
View
Surely I do not want to disable guard bytes globally, but I wish to know how to disable them globally, If possible.
mr.abzadeh
mr.abzadeh
19-Dec-12 6:15am
View
Thanks for your reply.
I do not allocate a lot of memory, and the guard bytes added by malloc is not important for me. The guard bytes added to stack to protect local variable is important to me, and the performance penalti is because of it because I call that functions in deeper loops so many times. I can avoid calling that simple functions and write it's code in the calling function, but this affects readability of my code, and readablity is very important to me. In general, I think there is no need to insert guard bytes to stack if a function does not use local variables, does not call functions and does not modify it's arguments.
mr.abzadeh
12-Sep-12 8:58am
View
I improved my question and a simple code to show how I create edit controls.
mr.abzadeh
12-Sep-12 8:51am
View
It is possible to add a horizontal scroll bar to edit control by adding style WS_HSCROLL and subclassing edit control and scroll bar messages. Buf I do not want this because of it's abnormal apperance and adding horizontal scroll bars to edit controls encreases the area used by control, reducing the count of visible edit controls in dialog. A better way is to create two buttons at left and right of edit control and handling their messages. It seams that this is the best and simplest answer to my question. Thanks
mr.abzadeh
12-Sep-12 8:35am
View
Deleted
It is possible to add a horizontal scroll bar to edit control by adding style WM_HSCROLL and subclassing edit control and scroll bar messages. Buf I do not want this because of it's abnormal apperance and adding horizontal scroll bars to edit controls encreases the area used by control, reducing the count of visible edit controls in dialog. A better way is to create two buttons at left and right of edit control and handling their messages. It seams that this is the best and simplest answer to my question. Thanks
mr.abzadeh
11-Sep-12 16:23pm
View
I use windows api (native C, visual studio 2010). I do not use .net and wpf
mr.abzadeh
11-Sep-12 16:22pm
View
Deleted
I use native C windows API (visual studio 2010). I do not use .net and wpf.
mr.abzadeh
11-Sep-12 15:59pm
View
I am not able to put arrows there, and edit control has no arrows by default, even for long text.
mr.abzadeh
5-Sep-12 7:07am
View
Sory, But I reposted my question to emphasis on PC Windows and not Windows mobile, and the previous post bad beed grayed, maybe by a silver member, and I do not know why and what is a post being grayed.
Thanks for showing that my question not clear. I want to use an established Internet (using modem) connection to communicate, And I want to transfer data.
mr.abzadeh
4-Sep-12 19:12pm
View
Searching "C Windows mobile GPRS" did not result to any Windows API help. It results to windows mobile api but I want to connect to GPRS from a PC.
Searching "C Windows API GPRS" also did not result to any Windows API help. It resulted to Windows CE articles.
mr.abzadeh
4-Sep-12 18:19pm
View
I think it is clear. It is clear, I want to use GPRS in windows API to connect to java applications on andrid. The applications In the androd side are created by jaba compilers.
mr.abzadeh
11-Apr-12 10:33am
View
Thanks for your reply.
These are good, but they compress large amount of data efficiently. I need an algorythm to compress small amount of data, from 100 bytes to 4k.
mr.abzadeh
11-Apr-12 3:57am
View
Thanks for your answer.
I am searching in google know.
Since I code in native cpp, I can not use System.IO.Compression Namespace.
Is there any library for compresion in native cpp?
mr.abzadeh
11-Apr-12 3:53am
View
I do not have an absolute minimum size.
I want to log Insert, update, deletes on a database
I want to collect the row's previous and next value, compress them and store in a log table. I can store small record, and compress larger ones, but since there are tens of milions of rows, speed and byte size as small as 100 bytes and even less is desirable,
Thanks
mr.abzadeh
11-Apr-12 3:13am
View
Thanks for your guidance.
I need lighter argorythm than huffman encoding, I want this: 1- compress small byte counts in memory, 2- good speed, 3- small code.
Does windows provide compression library?
mr.abzadeh
11-Apr-12 3:10am
View
Thanks, lzw may be acceptable as it addes 10 kb, Does it compress small arrays? Can you offer me a reliable link to download lzw? Do you know another algorythm with smaller code size?
mr.abzadeh
11-Apr-12 3:01am
View
Thanks for your interest.
You are right, I should specify os, which is windows xp sp2 and above.
And I do not have good familiaity with compresion algorythms,
by counting repeated bytes I mean very simple algorythms, not run-length encoding, what I want is: 1-compress small arrays, 2-speed, 3-small code
mr.abzadeh
21-Mar-12 16:27pm
View
ShowWindow didn't work, I did a thrick to solve the problem. Instead of
case WM_CLOSE:
SetFocus( hWndA );
DestroyWindow( hWndB );
I used this code
case WM_CLOSE:
SetFocus( hWndA );
PostMessage( hWndB, WM_APP_CLOSE, 0, 0 );
break;
case WM_APP_CLOSE:
DestroyWindow( hWndB );
break;
Indeed, SetFocus works if the message being processed does not destroy the window 'A', and I postponed the window destruction by posting an application defined message.
mr.abzadeh
21-Mar-12 16:20pm
View
Thanks for your interest
I couldn't know clearly what you point out. how to "inherit the 'A''s windows handle to 'B' window"? I used both SetFocus and ShowWindow, and none of them worked
mr.abzadeh
20-Mar-12 21:28pm
View
It does not work, but solution 1 is the currect answer.
mr.abzadeh
20-Mar-12 21:27pm
View
Deleted
It does not work.
Solution 1 is ok, this code works
case WM_CHAR: if ( wParam == VK_TAB ) return 0; break;
mr.abzadeh
20-Mar-12 21:25pm
View
Thanks, This is the case. It worked
I put this code in the message loop of edit control, and sound was bypassed.
case WM_CHAR: if ( wParam == VK_TAB ) return 0; break;
mr.abzadeh
20-Mar-12 21:16pm
View
Thanks for your reply.
I have tested it, and the sound still is played,
mr.abzadeh
19-Mar-12 4:14am
View
Thanks for your comment.
It's the default behaviour of edit control. The edit control has focus and the window sends key stroke events such as tab, enter, ... to the edit control, and it generates sound since it does not process them. A dialog does not send this key strokes to controls, but process them to navigate between controls. Calling the IsDialogMessage function in the window's message loop processes these key strokes, navigation is done correctly, and sound is not generated,
I realy want to find a way to handle this events myself, in the windows message loop, without using IsDialogMessage. I want to navigate as I wish.
In other words, I want to build my own dialog.
mr.abzadeh
6-Oct-11 10:28am
View
You have mentioned my question, no responce is given.
My question is: what to write in cache clause?
Can you please show me a clear example that catches divide by zero?
Thanks
mr.abzadeh
25-Sep-11 19:47pm
View
Thank you for your reply. This works well and is what I need.
Best reguards
mr.abzadeh
mr.abzadeh
25-Sep-11 19:46pm
View
This is very helpfull for me and i will use this code.
This tecknick is also aplicable in memory, where hInstanse or hModule actually pints to IMAGE_DOS_HEADER.
best regaurds
mr.abzadeh
mr.abzadeh
25-Sep-11 19:41pm
View
Solution 3 works well,
Thank you for your kind notes
mr.abzadeh
mr.abzadeh
25-Sep-11 4:51am
View
Thanks, Fine
It worked well. but it gives total module size, How to get code segment size?
mr.abzadeh
mr.abzadeh
25-Sep-11 3:26am
View
Protection is not a problem because the code segment has read attribute. It is possible to find the location of a variable in .exe, and even I can store checksum in another place, not in .exe. so aligning is not a problem.
Thanks for your comment
mr.abzadeh
mr.abzadeh
23-Sep-11 2:15am
View
Yes, In know this. I want to make reverse eng harder and time consuming. and many hacker will give up reverse eng if it is hard, also, note that a debugger waiting to finish decode will se the original code, but will not normally be enable to write back the original code to a dll or exe unless he or she has a comprehensive knowlege of portable executable structure and windows loader,
Thanks for your note
mr.abzadeh
22-Sep-11 3:07am
View
Thanks for your comprehensive reply.
I agree this does not have a complete solution. really I do protect my code against modification and what I want is to protect against reverse engineering. My code is in native C++ and since exe encryptors exist without sounding as malware to AVs, I think dll encryptors also should exist. The problem is finding a good one.
Another way is to encrypt part of my dll after build and decrypt it at run time. I can allocate an executable block of memory and decode my executable code to it, But It has the problem of handling relative addresses and I want to know if there exist a way to modify executable code in place. All your suggestions are appreciated.
mr.abzadeh
mr.abzadeh
22-Sep-11 2:45am
View
Thanks to your notice.
You are misunderstanding my querstion. I want to create a dll and encrypt it in my machine, then deliver it to end user.
It will be loaded at startup by a service only once and It delivers some functionality to my application.
mr.abzadeh
11-Sep-11 0:31am
View
The previous lib has come to me from SafeNet company and
I do not know wether it has been linked statically or dynamically.
How can I know That?
mr.abzadeh
10-Sep-11 4:00am
View
I linked statically to make an exe.
mr.abzadeh
18-Apr-11 15:30pm
View
mr.abzadeh - 7 mins ago
One way to prove that RangePtr is a smart ptr.
Disassemply shows that when instance of RangePtr goes out of scope, it is destructed as below
call _com_ptr_t<_com_IIID<excel::range,&_guid_00020846_0000_0000_c000_000000000046> >::~_com_ptr_t<_com_IIID<excel::range,&_guid_00020846_0000_0000_c000_000000000046> > (0E31087h).
mr.abzadeh
18-Apr-11 15:15pm
View
Deleted
One way to prove that RangePtr is a smart ptr.
Disassemply shows that when instance of RangePtr goes out of scope, it is destructed as below
00E21DAE call _com_ptr_t<_com_IIID<excel::range,&_guid_00020846_0000_0000_c000_000000000046> >::~_com_ptr_t<_com_IIID<excel::range,&_guid_00020846_0000_0000_c000_000000000046> > (0E31087h)
mr.abzadeh
18-Apr-11 14:43pm
View
No.
It just says this:
A definition for the 'RangePtr' could not be located
mr.abzadeh
18-Apr-11 14:07pm
View
It seems very resonable to be the case. but I found no way to examine. No help in msdn, no definition in *.tlh and *.tli files.
Thanks for your point out
abzadeh
mr.abzadeh
18-Apr-11 9:04am
View
StudentName is declared as
char m_StudentName[some number];
This declares m_StudentName as MBCS, even if using unicode chars, and The instruction
if( this->m_StudentName == "" )
compares two char pointers
mr.abzadeh
17-Apr-11 14:20pm
View
I think he uses unicode and solution 2 is True.
for m_StudentName to be unicode, It must be declared as
_TCHAR m_StudentName[some number];
or
wchar_t m_StudentName[some number];
mr.abzadeh
16-Apr-11 20:11pm
View
/* Why my browser doesnt show reply icon? So I have to add comment. */
Thats right. "1000" is a pointer to array of chars, and PutValue2 requires 1 argument of type VARIANT. I converted "1000" to VARIANT and It didnt work. I worked around and found that the reason is in the following code:
//This code caused pPrange->PutValue2(VARIANT *) to crach
Range * pRange = pSheet->GetRange("A1","A1");
pRange->PutValue2(VARIANT *);
//This code works well. It was extracted from the link above
pRangeAll = pSheet->Cells;
pRange = pRangeAll->Item[1][1];
pRange->PutValue2(VARIANT *);
I think the problem is in Range addressing, and I will examine it with care.
Another stange thing:
As you remember, Yesterday my compiler (VS2010) required PutVisible to pass two arguments( lcid, RHS ) and _Aplication->Visible = true; didnt compile.
But Now It has changed and PutVisible( lcid, RSH ) desn't compile(error: PutVisible doesn't have 2 arguments) and _Aplication->Visible = true; compiles. May be it's because my windows 7 was updated, buf I am not sure.
If you found an Idea about this strange behaviour, please post me at
mr.abzadeh@yahoo.com.
Thanks for your pointing out, good luck
abzadeh
mr.abzadeh
16-Apr-11 19:52pm
View
Deleted
/* Why my browser doesnt show reply icon? So I have to add comment. */
Thats right. "1000" is a pointer to array of chars, and PutValue2 requires 1 argument of type VARIANT. I converted "1000" to VARIANT and It didnt work. I worked around and found that the reason is in the following code:
//This code caused pPrange->PutValue2(VARIANT *) to crach
Range * pRange = pSheet->GetRange("A1","A1");
pRange->PutValue2(VARIANT *);
//This code works well. It was extracted from the link above
pRangeCells = pSheet->Cells;
pBeginRange = pRangeCells->Item[1][1];
pEndRange = pRangeCells->Item[1][1];
pRange = pSheet->Range[(Excel::Range*)pBeginRange][(Excel::Range*)pEndRange];
pRange->PutValue2(VARIANT *);
I think the problem is in Range addressing, and I will examine it with care.
Another stange thing:
As you remember, Yesterday my compiler (VS2010) required PutVisible to pass two arguments( lcid, RHS ) and _Aplication->Visible = true; didnt compile.
But Now It has changed and PutVisible( lcid, RSH ) desn't compile(error: PutVisible doesn't have 2 arguments) and _Aplication->Visible = true; compiles. May be it's because my windows 7 was updated, buf I am not sure.
If you found an Idea about this strange behaviour, please post me at
mr.abzadeh@yahoo.com.
Thanks for your pointing out, good luck
abzadeh
mr.abzadeh
16-Apr-11 12:18pm
View
Formerly I used office 2003 and _Application.Visible = TRUE worked well.
I think that since office 2007, Microsoft offers Visible property with 2 arguments, and hides The 1 argument one. I say 'Hides' because code written for office 2003 should and does work in office 2007 and 2010.
My question has been answered completely.
Thanks for your help and the links you found for me, Good luck
Abzadeh.
mr.abzadeh
16-Apr-11 12:15pm
View
Deleted
Formerly I used office 2003 and _Application.Visible = TRUE worked well.
I think that since office 2007, Microsoft offers Visible property with 2 arguments, and hides The 1 argument Visible property. I say 'Hides' because code
written with office 2003 should a nd does work in office 2007 and 2010.
My question has been answered completely.
Thanks for your help and the links you found for me, Good luck
Abzadeh
mr.abzadeh
16-Apr-11 2:09am
View
I found the error. I have created a COleSafeArray conaining of only strings, as in
saRet.Create(VT_BSTR, 2, numElements);
I can not Fill this ayyay with double or other types of data
Thanks for your reply
mr.abzadeh
16-Apr-11 2:04am
View
I examined this code, causes the same error.
pXL->Visible = true;//generates this error
/*
error C2660: 'Excel::_Application::PutVisible' : function does not take 1 arguments
*/
PutVisible is a wrapper function generated in mymodule.tli, which is follows
<pre>inline void Excel::_Application::PutVisible ( long lcid, VARIANT_BOOL RHS ) {
HRESULT _hr = put_Visible(lcid, RHS);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
}</pre>
I dont know what arguments lcid and RHS means for, but a 'true' value for RHS with any value for lcid works.
Can you post me the address of links you found about PutVisible? I need this to find the meaning of 'lcid' amd 'RHS' arguments and other information.
Thanks for your point out
abzadeh
mr.abzadeh
16-Apr-11 1:13am
View
Deleted
both passing a double and passing a variant containing double didnt work
here is an example from MSDN help for COleSafeArray::PutElement
VARIANT retVariantArray()
{
COleSafeArray saRet;
DWORD numElements[] = {10, 10}; // 10x10
// Create the 2 dimensional safe-array of type VT_R8 with size 10x10
saRet.Create(VT_R8, 2, numElements);
// Initialize safearray with values...
long index[2];
for(index[0] = 0; index[0] < 10; index[0]++)
{
for(index[1] = 0; index[1] < 10; index[1]++)
{
double val = index[0] + index[1]*10;
//populate the safearray elements with double values
saRet.PutElement(index, &val);
}
}
// Return the safe-array encapsulated in a VARIANT...
return saRet.Detach();
}
and It does not work. the following code generates exception.
saRet.PutElement(index, &val);
I hope T will find why the MSDN (VS2010) example does not work
Thank you for pointing out.
mr.abzadeh
16-Apr-11 0:59am
View
Deleted
I examined this code, causes the same error.
pXL->Visible = true;//generates this error
/*
error C2660: 'Excel::_Application::PutVisible' : function does not take 1 arguments
*/
PutVisible is a wrapper function generated in mymodule.tli, which is follows
<pre>inline void Excel::_Application::PutVisible ( long lcid, VARIANT_BOOL RHS ) {
HRESULT _hr = put_Visible(lcid, RHS);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
}</pre>
I dont know what arguments lcid and RHS means for, but a 'true' value for RHS with any value for lcid works.
Can you post me the address of links you found about PutVisible? I need this to find the meaning of 'lcid' amd 'RHS' arguments and other information.
Thanks for your point out
abzadeh
mr.abzadeh
16-Apr-11 0:58am
View
Deleted
mr.abzadeh - 40 secs ago
I examined this code, causes the same error.
pXL->Visible = true;//generates this error
/*
error C2660: 'Excel::_Application::PutVisible' : function does not take 1 arguments
*/
PutVisible is a wrapper function generated in mymodule.tli, which is follows
<pre>inline void Excel::_Application::PutVisible ( long lcid, VARIANT_BOOL RHS ) {
HRESULT _hr = put_Visible(lcid, RHS);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
}</pre>
I dont know what arguments lcid and RHS means for, but a 'true' value for RHS with any value for lcid works.
Can you post me the address of links you found about PutVisible? I need this to find the meaning of 'lcid' amd 'RHS' arguments and other information.
Thanks for your point out
abzadeh.
mr.abzadeh
16-Apr-11 0:54am
View
Deleted
I examined this code, causes the same error.
<pre>pXL->Visible = VARIANT_TRUE;//generates this error
/*
error C2660: 'Excel::_Application::PutVisible' : function does not take 1 arguments
*/
PutVisible is a wrapper function generated in mymodule.tli, which is follows
<pre>inline void Excel::_Application::PutVisible ( long lcid, VARIANT_BOOL RHS ) {
HRESULT _hr = put_Visible(lcid, RHS);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
}</pre>
I dont know what arguments lcid and RHS means for, but a 'true' value for RHS with any value for lcid works.
Can you post me the address of links you found about PutVisible? I need this to find the meaning of 'lcid' amd 'RHS' arguments and other information.
Thanks for your point out
abzadeh
mr.abzadeh
15-Apr-11 15:29pm
View
my browser (IE8) does not show reply icon, so I use addcomment.
What U mean by pXL->true;? It does not seem correct. I examined it however, and result was this error
<pre>error C2059: syntax error : 'constant'</pre>
I alse examined this code
<pre>pXL->PutVisible( VARIANT_TRUE, 1 );</pre>
It Complied successfully, meaning that PutVisible needs 2 arguments, but I dont know
their meaning
thanks
mr.abzadeh
15-Apr-11 14:10pm
View
Very clever.
My earlier questions subject was c++, and I thought Changing subject to Office, C++ could be a good idea.
mr.abzadeh
15-Apr-11 13:47pm
View
Thanks, I loaded link, source code, demo project and I am examining It.
mr.abzadeh
15-Apr-11 13:42pm
View
Well, It is a good idea. I wrote another function to pass double values.
<pre>void FillSafeArrayNumber(double fValue, int iRow, int iCol, COleSafeArray* sa){
long index[2];
index[0] = iRow;
index[1] = iCol;
sa->PutElement(index, &fValue);
}</pre>
It compiled, but didnt work. (exception occured)
The help for COleSafeArray::PutElement shows an example that calls it exactly as above(2nd param as double ptr). but there is not any overload.
<pre>void PutElement( long* rgIndices, void* pvData )</pre>
do you have any idea?
);PutElement
mr.abzadeh
13-Apr-11 19:06pm
View
It is the case when I want to subclass a single form but I want to add fields and properties to MyForm and to create forms inherited from MyForm and add controls to it in a generic way so that adding new form from IDE generate code such as this:
public class Form1: MyForm //instead of Form
This allows me to create instances of MyForm rapidly specialy when I create many different classes (forms) and access it's members or methods public of MyForm. Please notice that fields of different types of MyForm should have the same structure.
Is there anyway to do this?
Thanks for your interes and reply
mr.abzadeh
13-Apr-11 14:57pm
View
I will keep windows and write multi-os UI. I have a lot of research to do. Thank you for your
kind, helpfull, and extensive description..
mr.abzadeh
13-Apr-11 14:53pm
View
I will keep windows and write multi-os UI. I have a lot of research to do. Thank you for your kind, helpfull, and extensive description.
mr.abzadeh
13-Apr-11 14:51pm
View
Deleted
I will keep windows and write multi-os UI. I have a lot of research to do. Thank you for your
kind, helpfull, and extensive description.
mr.abzadeh
13-Apr-11 13:04pm
View
My code is Native C++, and my UI is isolated, all written by myself. So I can not use existing UI in the market And I should Write my OWN UI for linux, Is there enough similarity between window and linux, For example, Using window procegers, message handling and socketing?
Can you offer me an starting point to practice linux UI?
mr.abzadeh
13-Apr-11 12:40pm
View
I already have an extensive amount of code. Is it possible to compile them by GCC or QT with a resonable amount of effort?
My code is in Native CPP and I use windows messaging and sockets
thanks
mr.abzadeh
13-Apr-11 12:32pm
View
I will study the article you noticed to me, and does linux and os-mac use messaging in a way similar to windows sh that I convert my code?
mr.abzadeh
13-Apr-11 12:30pm
View
I have used windows messaging and windows sockets extensively, and none from the list you presented me, and since I have collected all my messaging and socketing in two modules, Is It possible to convert to linux by rewriting the two modules?
thanks in advance
abzadeh
mr.abzadeh
13-Apr-11 12:12pm
View
Can you tell me an example of windows-specific stuff? and which compiler should I use if I have not used it in my existing code?
Thanks in advance
abzadeh
mr.abzadeh
18-Dec-10 8:24am
View
It's all right. Thanks for your Precise answers. good bye
mr.abzadeh
18-Dec-10 8:15am
View
I did not call sizeof() in my code. I tried to pass a sequential class containing char fields to unsafe code and It didnot work. there is a conflict between ANSI char fields and [StructLayout(LayoutKind.Sequential)] attribute. I need to use type unicode char so that its size shouldnot change and
passing it to unsafe code in DLL make sense. Please refer to my comment 2 for Your EDIT 2
mr.abzadeh
18-Dec-10 7:57am
View
I used this code to pass a class to an unsafe DLL
using System.Runtime.InteropServices;
namespace ns1 {
[StructLayout(LayoutKind.Sequential)]
class Class1 {
.
.
char ch1;
char ch2;
.
.
};
so, ANSI implementation of char conflicts with [StructLayout(LayoutKind.Sequential)] attribute and type 'char' should not be used when passing struct or class to unsafe code because char type in structs or classes is multibyte ansi with predefined size of 1 byte, and changes to 2 bytes when assigning a 2 byte char. It would be a good thing if compiler annonced me for this conflict.
How can I have unicode chars in structs or classes?
mr.abzadeh
18-Dec-10 7:37am
View
Please refer to Answer 2.
Thanks for your intereset.
mr.abzadeh
18-Dec-10 7:36am
View
You are right. This is the case as in native C++. but c# documentation says that the type 'char' in C# is unicode. I encountered this problem when passing a class or struct to afunction in Native DLL.
.
How can we define unicode char in C# if char is ANSI multibyte?
mr.abzadeh
18-Dec-10 6:27am
View
I use Visual studio 2010. what version of VS you use?
mr.abzadeh
18-Dec-10 6:24am
View
because sizeof(char) is 2
mr.abzadeh
11-Dec-10 9:05am
View
Yes, I could add COUNT(*) to my SELECT statement but the result set has been passed to me so I can not change the query statement.
I want to get count of rows in an already existing result set.
Thanks for your interest
Show More